Refactor password update flow to use router.push for navigation and add session check before swapping authentication
This commit is contained in:
parent
0be8a9d4d2
commit
099773b161
2 changed files with 7 additions and 5 deletions
|
|
@ -73,7 +73,7 @@ export const FormPwSetup = ({ user, servizioId }: FormPwSetupProps) => {
|
|||
|
||||
setAlreadyRequested(true);
|
||||
toast.success(t.auth.login.success);
|
||||
window.location.assign(`/servizio/onboard/${servizioId}`);
|
||||
await router.push(`/servizio/onboard/${servizioId}`);
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t.auth.login.fail);
|
||||
|
|
|
|||
|
|
@ -136,10 +136,12 @@ export const authRouter = createTRPCRouter({
|
|||
)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
await passwordOverrideHandler({ input });
|
||||
if (!ctx.session) {
|
||||
await swapAuth({
|
||||
ctx: ctx,
|
||||
userId: input.id,
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}),
|
||||
ChangePassword: protectedProcedure
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue