feat: Switch the login page to the registration component by changing the routing parameters #3221 (#3307)

### What problem does this PR solve?
feat: Switch the login page to the registration component by changing
the routing parameters #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-11-08 19:47:22 +08:00
committed by GitHub
parent 85047e7e36
commit 20d686737a
3 changed files with 69 additions and 7 deletions

View File

@ -0,0 +1,19 @@
import { useCallback } from 'react';
import { useSearchParams } from 'umi';
export enum Step {
SignIn,
SignUp,
ForgotPassword,
ResetPassword,
VerifyEmail,
}
export const useSwitchStep = (step: Step) => {
const [_, setSearchParams] = useSearchParams();
const switchStep = useCallback(() => {
setSearchParams(new URLSearchParams({ step: step.toString() }));
}, [setSearchParams, step]);
return { switchStep };
};