Add trust center access requests
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Outlet } from "react-router";
|
||||
import { Logo, Button, IconArrowBoxLeft } from "@probo/ui";
|
||||
import { Logo, Button, IconArrowBoxLeft, useToast } from "@probo/ui";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { buildEndpoint } from "/providers/RelayProviders";
|
||||
import type { ReactNode } from "react";
|
||||
@@ -8,10 +8,12 @@ type Props = {
|
||||
organizationName: string;
|
||||
organizationLogo?: string | null;
|
||||
children?: ReactNode;
|
||||
isAuthenticated?: boolean;
|
||||
};
|
||||
|
||||
export function PublicTrustCenterLayout({ organizationName, organizationLogo, children }: Props) {
|
||||
export function PublicTrustCenterLayout({ organizationName, organizationLogo, children, isAuthenticated }: Props) {
|
||||
const { __ } = useTranslate();
|
||||
const { toast } = useToast();
|
||||
|
||||
const handleLogout = async () => {
|
||||
try {
|
||||
@@ -22,10 +24,13 @@ export function PublicTrustCenterLayout({ organizationName, organizationLogo, ch
|
||||
},
|
||||
credentials: 'include',
|
||||
});
|
||||
window.location.reload();
|
||||
} catch (error) {
|
||||
console.error('Logout failed');
|
||||
} finally {
|
||||
window.location.href = "/";
|
||||
toast({
|
||||
title: __("Error"),
|
||||
description: __("Logout failed"),
|
||||
variant: "error",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -67,13 +72,15 @@ export function PublicTrustCenterLayout({ organizationName, organizationLogo, ch
|
||||
<span>Powered by Probo</span>
|
||||
</a>
|
||||
</div>
|
||||
<Button
|
||||
variant="tertiary"
|
||||
icon={IconArrowBoxLeft}
|
||||
onClick={handleLogout}
|
||||
title={__("Logout")}
|
||||
className="text-sm"
|
||||
/>
|
||||
{isAuthenticated && (
|
||||
<Button
|
||||
variant="tertiary"
|
||||
icon={IconArrowBoxLeft}
|
||||
onClick={handleLogout}
|
||||
title={__("Logout")}
|
||||
className="text-sm"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user