This commit is contained in:
Mike Cao 2024-02-17 10:22:48 -08:00
commit b1dae9c484
2 changed files with 25 additions and 20 deletions

22
src/app/sso/SSOPage.tsx Normal file
View File

@ -0,0 +1,22 @@
'use client';
import { useEffect } from 'react';
import { Loading } from 'react-basics';
import { useRouter, useSearchParams } from 'next/navigation';
import { setClientAuthToken } from 'lib/client';
export default function SSOPage() {
const router = useRouter();
const search = useSearchParams();
const url = search.get('url');
const token = search.get('token');
useEffect(() => {
if (url && token) {
setClientAuthToken(token);
router.push(url);
}
}, [router, url, token]);
return <Loading />;
}

View File

@ -1,22 +1,5 @@
'use client';
import { useEffect } from 'react';
import { Loading } from 'react-basics';
import { useRouter, useSearchParams } from 'next/navigation';
import { setClientAuthToken } from 'lib/client';
import SSOPage from './SSOPage';
export default function SSOPage() {
const router = useRouter();
const search = useSearchParams();
const url = search.get('url');
const token = search.get('token');
useEffect(() => {
if (url && token) {
setClientAuthToken(token);
router.push(url);
}
}, [router, url, token]);
return <Loading />;
export default function () {
return <SSOPage />;
}