Skip to content

Commit

Permalink
feat: force cookie removal
Browse files Browse the repository at this point in the history
  • Loading branch information
iaurg committed Dec 8, 2023
1 parent af765b6 commit 4cacf67
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/src/contexts/AuthContext.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"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";
Expand Down Expand Up @@ -31,8 +29,10 @@ export const AuthContext = createContext<AuthContextType>(
);

export function signOut() {
Cookies.remove('accessToken');
Cookies.remove('refreshToken');
nookies.destroy(null, "accessToken");
nookies.destroy(null, "refreshToken");
nookies.set(null, "accessToken", "", { path: "/" });
nookies.set(null, "refreshToken", "", { path: "/" });
api.defaults.headers["Authorization"] = "";
window.location.replace("/");
}
Expand Down

0 comments on commit 4cacf67

Please sign in to comment.