Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Luxshan2000 committed Nov 1, 2023
1 parent 4358c71 commit f34fec6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions webapp/src/utils/logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ import axios from 'axios';
import { BACKEND_URL } from './constants';

export const logout = () => {
axios.defaults.withCredentials = true
console.log("clciked")
// Add logout functionality here
axios.post(`${BACKEND_URL}/api/auth/logout`)
.then((res)=>{
// axios.defaults.withCredentials = true
// console.log("clciked")
// // Add logout functionality here
// axios.post(`${BACKEND_URL}/api/auth/logout`)
// .then((res)=>{
// window.location.reload(true);
// window.location.href = "/";
// }).catch((err)=>console.log(err))
try{
localStorage.removeItem("token");
window.location.reload(true);
window.location.href = "/";
}).catch((err)=>console.log(err))

}
catch(err){
console.log("Error")
}
};


Expand Down
2 changes: 1 addition & 1 deletion webapp/src/views/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function Login() {


useEffect(()=>{
if(getSessionCookie("token")){
if(localStorage.getItem("token")){
navigate("/dashboard", {replace:true})
}
},[])
Expand Down

0 comments on commit f34fec6

Please sign in to comment.