Changed client to add token to logout call

This commit is contained in:
2025-03-17 22:29:05 +01:00
parent ec9d9ad1c5
commit 967211565b

View File

@@ -1,3 +1,5 @@
import { useUserStore } from "~/hooks/user";
interface get {
"/item": {
parameters: {
@@ -37,6 +39,7 @@ interface post {
username: string;
password: string;
};
token?: never;
};
return: User;
};
@@ -44,6 +47,7 @@ interface post {
parameters: {
query?: never;
body?: never;
token: string;
};
return?: never;
};
@@ -55,6 +59,7 @@ interface post {
password: string;
email: string;
};
token?: never;
};
return?: never;
};
@@ -78,6 +83,7 @@ export interface Case {
export interface User {
uuid: string;
username: string;
token: string;
}
class Client {
@@ -96,6 +102,7 @@ class Client {
: "";
let response = await fetch(this.baseUrl + path + query, {
method: "GET",
credentials: "include",
headers: {
"Content-Type": "application/json",
},
@@ -114,8 +121,12 @@ class Client {
let response = await fetch(this.baseUrl + path + query, {
method: "POST",
body: JSON.stringify(parameters["body"]),
credentials: "include",
headers: {
"Content-Type": "application/json",
Authorization: parameters["token"]
? "Bearer " + parameters["token"]
: "",
},
});
let data;