From 89aea05dd4c83f20269065327fea9aa17b4696f7 Mon Sep 17 00:00:00 2001 From: krokodilka Date: Sun, 7 May 2023 10:37:30 +0300 Subject: [PATCH] =?UTF-8?q?+=20withCredentials:=20true=20=D0=B2=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=20axios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/dashboard/Content/Users.tsx | 12 ++++++------ src/pages/dashboard/Header/index.tsx | 2 +- src/stores/auth.ts | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/pages/dashboard/Content/Users.tsx b/src/pages/dashboard/Content/Users.tsx index ffe0e2e..a281b26 100644 --- a/src/pages/dashboard/Content/Users.tsx +++ b/src/pages/dashboard/Content/Users.tsx @@ -24,12 +24,12 @@ import ConditionalRender from "@root/pages/Setting/ConditionalRender"; const Users: React.FC = () => { const { makeRequest } = authStore(); - makeRequest({ - url: "https://admin.pena.digital/strator/account", - method: "get", - bearer: true, - contentType: true, - }) + // makeRequest({ + // url: "https://admin.pena.digital/strator/account", + // method: "get", + // bearer: true, + // contentType: true, + // }) const radioboxes = ["admin", "manager", "user"]; const [selectedValue, setSelectedValue] = React.useState("admin"); diff --git a/src/pages/dashboard/Header/index.tsx b/src/pages/dashboard/Header/index.tsx index b7feb52..be7cdb1 100644 --- a/src/pages/dashboard/Header/index.tsx +++ b/src/pages/dashboard/Header/index.tsx @@ -53,7 +53,7 @@ const Header: React.FC = () => { { makeRequest({ - url: "https://admin.pena.digital/auth/auth/logout", + url: "https://admin.pena.digital/auth/logout", contentType: true, }).then(() => localStorage.setItem("AT", "")); }} diff --git a/src/stores/auth.ts b/src/stores/auth.ts index 93cdf17..806023a 100644 --- a/src/stores/auth.ts +++ b/src/stores/auth.ts @@ -68,12 +68,14 @@ async function makeRequest({ headers, data: body, signal, + withCredentials: true }); if (data?.accessToken) { HC(data.accessToken); } + console.log(data) return data; } catch (nativeError: unknown) { const error = nativeError as AxiosError;