Params fix
This commit is contained in:
parent
786217b753
commit
88fff73cc0
3 changed files with 9 additions and 10 deletions
|
|
@ -8,15 +8,14 @@ type LoginCallbackProps = RouteComponentProps;
|
|||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export function LoginCallback(_: LoginCallbackProps) {
|
||||
const currentURL = window.location.href;
|
||||
const urlParams = new URLSearchParams(currentURL);
|
||||
const state = urlParams.get('state');
|
||||
const indexOfQuestionMark = currentURL.indexOf('?');
|
||||
const params = currentURL.slice(indexOfQuestionMark);
|
||||
|
||||
const { logIn } = useAuth();
|
||||
|
||||
useEffect(() => {
|
||||
if (state) {
|
||||
const res = logIn(state);
|
||||
|
||||
if (params) {
|
||||
const res = logIn(params);
|
||||
// @ts-ignore
|
||||
if (res.ok) {
|
||||
showToast('Logged in');
|
||||
|
|
@ -25,7 +24,7 @@ export function LoginCallback(_: LoginCallbackProps) {
|
|||
navigate('/login');
|
||||
}
|
||||
}
|
||||
}, [logIn, state]);
|
||||
}, [logIn, params]);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8">
|
||||
|
|
|
|||
Reference in a new issue