2022-10-31 19:02:37 +01:00
|
|
|
import { useEffect } from 'react';
|
|
|
|
import { useRouter } from 'next/router';
|
|
|
|
import { setItem } from 'next-basics';
|
|
|
|
import { AUTH_TOKEN } from 'lib/constants';
|
|
|
|
|
|
|
|
export default function SingleSignOnPage() {
|
|
|
|
const router = useRouter();
|
|
|
|
const { token, url } = router.query;
|
|
|
|
|
|
|
|
useEffect(() => {
|
2022-11-09 07:58:52 +01:00
|
|
|
if (url && token) {
|
2022-10-31 19:02:37 +01:00
|
|
|
setItem(AUTH_TOKEN, token);
|
|
|
|
|
2022-11-09 07:58:52 +01:00
|
|
|
router.push(url);
|
2022-10-31 19:02:37 +01:00
|
|
|
}
|
2022-11-10 07:12:40 +01:00
|
|
|
}, [router, url, token]);
|
2022-10-31 19:02:37 +01:00
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|