Implement invitation renewal and optimize revalidation function
This commit adds a new function to renew team invitations and a central function for revalidating member page. It also removes redundant revalidations across different actions. The renew invitation function and UI elements are introduced including a new dialog for confirming the renewal action. Furthermore, function revalidateMemberPage() is added to abstract the revalidation path used multiple times in different functions. The code readability and maintainability have thus been improved.
This commit is contained in:
@@ -10,15 +10,18 @@ import pathsConfig from '~/config/paths.config';
|
||||
interface Params {
|
||||
searchParams: {
|
||||
error: string;
|
||||
invite_token: string;
|
||||
};
|
||||
}
|
||||
|
||||
function AuthCallbackErrorPage({ searchParams }: Params) {
|
||||
const { error } = searchParams;
|
||||
const { error, invite_token } = searchParams;
|
||||
const queryParam = invite_token ? `?invite_token=${invite_token}` : '';
|
||||
const signInPath = pathsConfig.auth.signIn + queryParam;
|
||||
|
||||
// if there is no error, redirect the user to the sign-in page
|
||||
if (!error) {
|
||||
redirect(pathsConfig.auth.signIn);
|
||||
redirect(signInPath);
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -36,7 +39,7 @@ function AuthCallbackErrorPage({ searchParams }: Params) {
|
||||
</div>
|
||||
|
||||
<Button>
|
||||
<Link href={pathsConfig.auth.signIn}>
|
||||
<Link href={signInPath}>
|
||||
<Trans i18nKey={'auth:signIn'} />
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user