feat: use logout endpoint for logout and move old logic to revoke in auth
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful

This commit is contained in:
SauceyRed 2025-07-05 02:38:23 +02:00
parent 87f4ecc9dc
commit aa335b086a
Signed by: sauceyred
GPG key ID: 2BF92EB6D8A5CCA7

View file

@ -37,13 +37,19 @@ export const useAuth = () => {
//await fetchUser();
}
async function logout(password: string) {
console.log("password:", password);
async function logout() {
console.log("access:", accessToken.value);
const hashedPass = await hashPassword(password);
console.log("hashed");
const res = await fetchWithApi("/auth/revoke", {
await fetchWithApi("/auth/logout", { method: "GET", credentials: "include" });
clearAuth();
return await navigateTo("/login");
}
async function revoke(password: string) {
const hashedPass = await hashPassword(password);
await fetchWithApi("/auth/revoke", {
method: "POST",
body:
{
@ -54,10 +60,6 @@ export const useAuth = () => {
clearAuth();
}
async function revoke() {
clearAuth();
}
async function refresh() {
console.log("refreshing");
const res = await fetchWithApi("/auth/refresh", {