umami/pages/sso.js

20 lines
430 B
JavaScript
Raw Normal View History

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(() => {
if (url && token) {
2022-10-31 19:02:37 +01:00
setItem(AUTH_TOKEN, token);
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;
}