This commit is contained in:
Stefan Pejcic
2024-11-07 19:03:37 +01:00
parent c6df945ed5
commit 09f9f9502d
2472 changed files with 620417 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import { ory } from "./ory";
export const isAuthenticated = async () => {
try {
const response = await ory.toSession();
const authenticatedHeader = response.headers["refine-is-authenticated"];
if (authenticatedHeader === "false") {
return false;
}
return true;
} catch (error: any) {
return false;
}
};
export const logoutUser = async () => {
try {
await ory.performNativeLogout({
performNativeLogoutBody: {
session_token: "",
},
});
return true;
} catch (_) {
return false;
}
};