feat: implement membership confirmation flow and update related functionalities
This commit is contained in:
11
app/auth/membership-confirmation/layout.tsx
Normal file
11
app/auth/membership-confirmation/layout.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
|
||||
async function SiteLayout(props: React.PropsWithChildren) {
|
||||
return (
|
||||
<div className={'flex min-h-[100vh] flex-col items-center justify-center'}>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default withI18n(SiteLayout);
|
||||
46
app/auth/membership-confirmation/page.tsx
Normal file
46
app/auth/membership-confirmation/page.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
import pathsConfig from '@/config/paths.config';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { usePersonalAccountData } from '@kit/accounts/hooks/use-personal-account-data';
|
||||
import { SuccessNotification } from '@kit/notifications/components';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
|
||||
async function UpdateAccountSuccess() {
|
||||
const { t } = useTranslation('account');
|
||||
const client = getSupabaseServerClient();
|
||||
|
||||
const {
|
||||
data: { user },
|
||||
} = await client.auth.getUser();
|
||||
|
||||
if (!user?.id) {
|
||||
redirect(pathsConfig.app.home);
|
||||
}
|
||||
|
||||
const { data: accountData } = usePersonalAccountData(user.id);
|
||||
|
||||
if (!accountData?.id) {
|
||||
redirect(pathsConfig.app.home);
|
||||
}
|
||||
|
||||
return (
|
||||
<SuccessNotification
|
||||
showLogo={false}
|
||||
title={t('account:membershipConfirmation:successTitle', {
|
||||
firstName: accountData?.name,
|
||||
lastName: accountData?.last_name,
|
||||
})}
|
||||
descriptionKey="account:membershipConfirmation:successDescription"
|
||||
buttonProps={{
|
||||
buttonTitleKey: 'account:membershipConfirmation:successButton',
|
||||
href: pathsConfig.app.selectPackage,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default withI18n(UpdateAccountSuccess);
|
||||
@@ -1,17 +0,0 @@
|
||||
import { getSupabaseServerClient } from '@/packages/supabase/src/clients/server-client';
|
||||
|
||||
import { UpdateAccountSuccessNotification } from '@kit/notifications/components';
|
||||
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
|
||||
async function UpdateAccountSuccess() {
|
||||
const client = getSupabaseServerClient();
|
||||
|
||||
const {
|
||||
data: { user },
|
||||
} = await client.auth.getUser();
|
||||
|
||||
return <UpdateAccountSuccessNotification userId={user?.id} />;
|
||||
}
|
||||
|
||||
export default withI18n(UpdateAccountSuccess);
|
||||
Reference in New Issue
Block a user