From 6162f8f891839e8ae8c36dc0496b26fc61e96a87 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 12 Aug 2024 22:51:40 +0800 Subject: [PATCH] :bug: User related requests enable with credentials to prevent some errors --- components/account/AuthTicketTable.vue | 3 +++ pages/auth/authorize.vue | 2 ++ stores/userinfo.ts | 1 + 3 files changed, 6 insertions(+) diff --git a/components/account/AuthTicketTable.vue b/components/account/AuthTicketTable.vue index 011b1a6..9b4621b 100644 --- a/components/account/AuthTicketTable.vue +++ b/components/account/AuthTicketTable.vue @@ -131,6 +131,7 @@ async function readTickets({ page, itemsPerPage }: { page?: number; itemsPerPage }), { headers: { Authorization: `Bearer ${getAtk()}` }, + credentials: "include", }, ) if (res.status !== 200) { @@ -156,6 +157,7 @@ async function readEvents({ page, itemsPerPage }: { page?: number; itemsPerPage? }), { headers: { Authorization: `Bearer ${getAtk()}` }, + credentials: "include", }, ) if (res.status !== 200) { @@ -175,6 +177,7 @@ async function killTicket(item: any) { const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/users/me/tickets/${item.id}`, { method: "DELETE", headers: { Authorization: `Bearer ${getAtk()}` }, + credentials: "include", }) if (res.status !== 200) { error.value = await res.text() diff --git a/pages/auth/authorize.vue b/pages/auth/authorize.vue index a0a1a7e..7ac8bc8 100755 --- a/pages/auth/authorize.vue +++ b/pages/auth/authorize.vue @@ -90,6 +90,7 @@ const panel = ref("confirm") async function tryAuthorize() { const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth/o/authorize` + window.location.search, { headers: { Authorization: `Bearer ${getAtk()}` }, + credentials: "include", }) if (res.status !== 200) { @@ -123,6 +124,7 @@ async function approve() { const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/auth/o/authorize` + window.location.search, { method: "POST", headers: { Authorization: `Bearer ${getAtk()}` }, + credentials: "include", }) if (res.status !== 200) { diff --git a/stores/userinfo.ts b/stores/userinfo.ts index f8b0052..bfc2608 100644 --- a/stores/userinfo.ts +++ b/stores/userinfo.ts @@ -40,6 +40,7 @@ export const useUserinfo = defineStore("userinfo", () => { const res = await fetch(`${config.public.solarNetworkApi}/cgi/auth/users/me`, { headers: { Authorization: `Bearer ${getAtk()}` }, + credentials: "include", }) if (res.status !== 200) {