diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index a9a6f9d..80de91f 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -13,6 +13,7 @@
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query-devtools": "^4.36.1",
"axios": "^1.6.2",
+ "js-cookie": "^3.0.5",
"jwt-decode": "^4.0.0",
"konva": "^9.2.3",
"next": "^14.0.3",
@@ -28,6 +29,7 @@
"typescript": "^5.3.2"
},
"devDependencies": {
+ "@types/js-cookie": "^3.0.6",
"@types/node": "^20.10.3",
"@types/react": "^18.2.41",
"@types/react-dom": "^18.2.17",
@@ -959,6 +961,12 @@
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
},
+ "node_modules/@types/js-cookie": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-3.0.6.tgz",
+ "integrity": "sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==",
+ "dev": true
+ },
"node_modules/@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
@@ -3383,6 +3391,14 @@
"jiti": "bin/jiti.js"
}
},
+ "node_modules/js-cookie": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz",
+ "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==",
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index 65d2311..61db7b9 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -15,6 +15,7 @@
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query-devtools": "^4.36.1",
"axios": "^1.6.2",
+ "js-cookie": "^3.0.5",
"jwt-decode": "^4.0.0",
"konva": "^9.2.3",
"next": "^14.0.3",
@@ -30,6 +31,7 @@
"typescript": "^5.3.2"
},
"devDependencies": {
+ "@types/js-cookie": "^3.0.6",
"@types/node": "^20.10.3",
"@types/react": "^18.2.41",
"@types/react-dom": "^18.2.17",
diff --git a/frontend/src/components/Header/index.tsx b/frontend/src/components/Header/index.tsx
index 1ff897d..ae0f221 100644
--- a/frontend/src/components/Header/index.tsx
+++ b/frontend/src/components/Header/index.tsx
@@ -29,8 +29,7 @@ export default function Header() {
Ranking
- signOut()}
@@ -38,7 +37,7 @@ export default function Header() {
>
Sair
-
+
);
diff --git a/frontend/src/contexts/AuthContext.tsx b/frontend/src/contexts/AuthContext.tsx
index fb56b0d..08c081e 100644
--- a/frontend/src/contexts/AuthContext.tsx
+++ b/frontend/src/contexts/AuthContext.tsx
@@ -1,5 +1,7 @@
"use client";
import nookies from "nookies";
+import Cookies from 'js-cookie';
+
import React, { createContext, useEffect, useState } from "react";
import { api } from "@/services/apiClient";
import { User } from "@/types/user";
@@ -29,8 +31,8 @@ export const AuthContext = createContext(
);
export function signOut() {
- nookies.destroy(null, "accessToken");
- nookies.destroy(null, "refreshToken");
+ Cookies.remove('accessToken');
+ Cookies.remove('refreshToken');
api.defaults.headers["Authorization"] = "";
window.location.replace("/");
}