umami/pages/sso.js

19 lines
395 B
JavaScript
Raw Normal View History

2022-10-31 19:02:37 +01:00
import { useEffect } from 'react';
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
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;
}