Working on role in workspace.

This commit is contained in:
charles-gauthereau
2024-12-31 10:54:18 +01:00
parent e1a7ca8558
commit 6f75079a40
29 changed files with 464 additions and 124 deletions
+17 -6
View File
@@ -3,6 +3,7 @@
import {redirect} from "next/navigation";
import {signIn, signOut} from "@/auth/auth";
import {getServerUrl} from "@/utils/get-server-url";
import {deleteOrganizationCookie} from "@/features/dashboard/organization-cookie";
//
// const baseUrl = getServerUrl();
// async function fetchCsrfToken() {
@@ -35,13 +36,23 @@ import {getServerUrl} from "@/utils/get-server-url";
// }
// }
//
export const signOutAction = async () => {
// await manualSignOut()
await signOut({redirectTo: '/', redirect: true})
window.location.reload();
}
const deleteCookieResponse = await deleteOrganizationCookie();
await signOut({ redirectTo: '/', redirect: true });
if (typeof window !== 'undefined') {
window.location.reload();
}
return deleteCookieResponse;
};
//
// export const signOutAction = async () => {
// // await manualSignOut()
// await signOut({redirectTo: '/', redirect: true})
// await deleteOrganizationCookie()
// window.location.reload();
// }
export const signInAction = async (type: string, formData?: any) => {
if (type === "google") {
await signIn(type, {redirectTo: '/dashboard'})