umami/pages/sso.js

20 lines
452 B
JavaScript
Raw Normal View History

2022-10-31 19:02:37 +01:00
import { useEffect } from 'react';
2023-01-31 06:44:07 +01:00
import { Loading } from 'react-basics';
2022-10-31 19:02:37 +01:00
import { useRouter } from 'next/router';
import { setClientAuthToken } from 'lib/client';
2022-10-31 19:02:37 +01:00
export default function SingleSignOnPage() {
const router = useRouter();
const { token, url } = router.query;
useEffect(() => {
if (url && token) {
setClientAuthToken(token);
2022-10-31 19:02:37 +01:00
2023-04-07 05:35:55 +02:00
router.push(url);
2022-10-31 19:02:37 +01:00
}
2023-04-07 05:35:55 +02:00
}, [router, url, token]);
2022-10-31 19:02:37 +01:00
2023-01-31 06:44:07 +01:00
return <Loading size="xl" />;
2022-10-31 19:02:37 +01:00
}