Increase refetchInterval in SessionProvider for improved data consistency
This commit is contained in:
parent
f9b3f3e51e
commit
0be8a9d4d2
4 changed files with 40 additions and 38 deletions
|
|
@ -1026,7 +1026,7 @@ export const FormNewServizioAcquisto = ({
|
|||
className={cn(
|
||||
"h-[42px] w-full pl-3 text-left font-medium",
|
||||
!field.value && "text-muted-foreground",
|
||||
`text-primary dark:bg-primary mt-2 rounded-lg border border-neutral-300 bg-white shadow-xs outline-hidden file:border-0 file:bg-transparent file:text-sm file:font-medium hover:border-neutral-400 focus:border-neutral-400 disabled:cursor-not-allowed disabled:opacity-50 aria-expanded:border-neutral-400 dark:border-neutral-500 dark:text-white dark:placeholder:text-neutral-400 dark:hover:border-neutral-400 dark:focus:border-transparent dark:aria-expanded:border-neutral-400`,
|
||||
`text-primary dark:bg-primary rounded-lg border border-neutral-300 bg-white shadow-xs outline-hidden file:border-0 file:bg-transparent file:text-sm file:font-medium hover:border-neutral-400 focus:border-neutral-400 disabled:cursor-not-allowed disabled:opacity-50 aria-expanded:border-neutral-400 dark:border-neutral-500 dark:text-white dark:placeholder:text-neutral-400 dark:hover:border-neutral-400 dark:focus:border-transparent dark:aria-expanded:border-neutral-400`,
|
||||
)}
|
||||
>
|
||||
{field.value ? (
|
||||
|
|
@ -1061,6 +1061,39 @@ export const FormNewServizioAcquisto = ({
|
|||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="nazione_nascita"
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full">
|
||||
<div className="flex flex-wrap items-center gap-x-2">
|
||||
<FormLabel htmlFor="select-naz-nascita">
|
||||
{t.anagrafica.nazioneNascita}
|
||||
</FormLabel>
|
||||
<FormMessage />
|
||||
</div>
|
||||
|
||||
<FormControl>
|
||||
<MultiSelect
|
||||
elementId="select-naz-nascita"
|
||||
elementName="nazioneNascita"
|
||||
options={UnpackOptions({ options: nazioni_options })}
|
||||
defaultValue={RepackValues({
|
||||
options: nazioni_options,
|
||||
values: field.value,
|
||||
})}
|
||||
onValueChange={async (value) => {
|
||||
field.onChange(value.value);
|
||||
await form.trigger("luogo_nascita");
|
||||
}}
|
||||
placeholder="Seleziona..."
|
||||
isMulti={false}
|
||||
/>
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="luogo_nascita"
|
||||
|
|
@ -1118,38 +1151,6 @@ export const FormNewServizioAcquisto = ({
|
|||
);
|
||||
}}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="nazione_nascita"
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full">
|
||||
<div className="flex flex-wrap items-center gap-x-2">
|
||||
<FormLabel htmlFor="select-naz-nascita">
|
||||
{t.anagrafica.nazioneNascita}
|
||||
</FormLabel>
|
||||
<FormMessage />
|
||||
</div>
|
||||
|
||||
<FormControl>
|
||||
<MultiSelect
|
||||
elementId="select-naz-nascita"
|
||||
elementName="nazioneNascita"
|
||||
options={UnpackOptions({ options: nazioni_options })}
|
||||
defaultValue={RepackValues({
|
||||
options: nazioni_options,
|
||||
values: field.value,
|
||||
})}
|
||||
onValueChange={async (value) => {
|
||||
field.onChange(value.value);
|
||||
await form.trigger("luogo_nascita");
|
||||
}}
|
||||
placeholder="Seleziona..."
|
||||
isMulti={false}
|
||||
/>
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
|
|
@ -1160,9 +1161,9 @@ export const FormNewServizioAcquisto = ({
|
|||
<FormLabel htmlFor="select-sesso">
|
||||
<TooltipProvider>
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger className="flex items-center gap-x-2">
|
||||
<TooltipTrigger className="relative flex items-center gap-x-2">
|
||||
{t.anagrafica.sesso}{" "}
|
||||
<HelpCircleIcon className="size-5" />
|
||||
<HelpCircleIcon className="absolute -right-6 size-5" />
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
{t.anagrafica.sesso_disclamer}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export const FormPwSetup = ({ user, servizioId }: FormPwSetupProps) => {
|
|||
|
||||
setAlreadyRequested(true);
|
||||
toast.success(t.auth.login.success);
|
||||
await router.push(`/servizio/onboard/${servizioId}`);
|
||||
window.location.assign(`/servizio/onboard/${servizioId}`);
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t.auth.login.fail);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ export const authMiddleware = async (req: NextRequest) => {
|
|||
const accessToken = req.cookies.get(ACCESS_TOKEN_COOKIE_NAME)?.value;
|
||||
|
||||
const isProtectedRoute =
|
||||
path.startsWith("/area-riservata") || path.startsWith("/servizio");
|
||||
(path.startsWith("/area-riservata") || path.startsWith("/servizio")) &&
|
||||
!path.startsWith("/servizio/pre-onboard");
|
||||
|
||||
if (isProtectedRoute) {
|
||||
if (!accessToken) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export const SessionProvider: FC<{ children: ReactNode }> = ({ children }) => {
|
|||
refetchOnReconnect: true,
|
||||
refetchOnMount: true,
|
||||
staleTime: 0,
|
||||
refetchInterval: 200,
|
||||
refetchInterval: 30000,
|
||||
});
|
||||
|
||||
// Invalidate session on route change
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue