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