mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Working on role in workspace.
This commit is contained in:
@@ -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'})
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import {cookies} from 'next/headers';
|
||||
|
||||
|
||||
const COOKIE_NAME = 'PORTABASE_ORGANIZATION_SLUG';
|
||||
|
||||
export async function getCurrentOrganizationSlug() {
|
||||
@@ -11,4 +10,8 @@ export async function getCurrentOrganizationSlug() {
|
||||
|
||||
export async function setCurrentOrganizationSlug(slug: string) {
|
||||
return (await cookies()).set(COOKIE_NAME, slug).get(COOKIE_NAME)?.value;
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteOrganizationCookie() {
|
||||
return (await cookies()).delete(COOKIE_NAME);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user