Files
myeasycms-v2/apps/web/app/admin/users/@modal/[uid]/components/ImpersonateUserAuthSetter.tsx
giancarlo cb8b23e8c0 Remove billing and checkout redirect buttons and related services
Deleted the billing-redirect-button, checkout-redirect-button, and embedded-stripe-checkout components. Additionally, removed the shadcn directory, which encompassed billing-related icons. This change streamlines the subscription settings interface and organizes the system's payment management. This update is a stepping stone towards improving the billing system's overall architecture.
2024-03-25 11:39:41 +08:00

53 lines
1.0 KiB
TypeScript

'use client';
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import Spinner from '@/components/app/Spinner';
import useSupabase from '@kit/hooks/use-supabase';
function ImpersonateUserAuthSetter({
tokens,
}: React.PropsWithChildren<{
tokens: {
accessToken: string;
refreshToken: string;
};
}>) {
const supabase = useSupabase();
const router = useRouter();
useEffect(() => {
async function setAuth() {
await supabase.auth.setSession({
refresh_token: tokens.refreshToken,
access_token: tokens.accessToken,
});
router.push('/dashboard');
}
void setAuth();
}, [router, tokens, supabase.auth]);
return (
<div
className={
'flex h-screen w-screen flex-1 flex-col items-center justify-center'
}
>
<div className={'flex flex-col items-center space-y-4'}>
<Spinner />
<div>
<p>Setting up your session...</p>
</div>
</div>
</div>
);
}
export default ImpersonateUserAuthSetter;