mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-22 23:17:09 +00:00
fix: authorization
This commit is contained in:
@@ -23,8 +23,8 @@ export const authFetch = ofetch.create({
|
||||
|
||||
export const apiFetch = ofetch.create({
|
||||
baseURL: BASE_URL,
|
||||
headers: {
|
||||
Authorization: "Bearer " + getToken(),
|
||||
async onRequest({ options }) {
|
||||
options.headers.set("Authorization", "Bearer " + getToken());
|
||||
},
|
||||
async onResponseError({ response }) {
|
||||
if (response.status === 401) {
|
||||
|
||||
@@ -6,8 +6,6 @@ export const getToken = () => {
|
||||
|
||||
export const saveToken = (token: string) => {
|
||||
Cookie.set("token", token, {
|
||||
secure: true,
|
||||
sameSite: "Strict",
|
||||
expires: 30,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user