Fixed more org related functionality

This commit is contained in:
frikky
2020-10-31 09:11:00 +01:00
parent fdba86f9c3
commit a6a5bc9d30
10 changed files with 405 additions and 247 deletions
+23 -18
View File
@@ -19,7 +19,7 @@ const hoverColor = "#f85a3e"
const hoverOutColor = "#e8eaf6"
const Header = props => {
const { globalUrl, isLoggedIn, removeCookie, homePage, isLoaded, userdata } = props;
const { globalUrl, isLoggedIn, removeCookie, homePage, isLoaded, userdata, cookies } = props;
const theme = useTheme();
const [HomeHoverColor, setHomeHoverColor] = useState(hoverOutColor);
@@ -35,26 +35,31 @@ const Header = props => {
// DEBUG HERE
const handleClickLogout = () => {
console.log("SHOULD LOG OUT")
console.log(isLoggedIn)
console.log("COOKIES: ", cookies, "Remover: ", removeCookie)
// Don't really care about the logout
fetch(globalUrl+"/api/v1/logout", {
fetch(globalUrl+"/api/v1/logout", {
credentials: "include",
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
})
.then(() => {
// Log out anyway
removeCookie("session_token", {path: "/"})
//window.location.pathname = "/"
})
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
})
.then(() => {
// Log out anyway
//cookies.remove("session_token")
//window.location.pathname = "/"
console.log("Should've logged out")
removeCookie("session_token", {path: "/"})
removeCookie("session_token", {path: "/workflows"})
window.location.reload()
})
.catch(error => {
console.log(error)
});
}
console.log("Error in logout: ", error)
removeCookie("session_token", {path: "/"})
window.location.reload()
//removeCookie("session_token", {path: "/"})
})
}
// Rofl this is weird
const handleDocsHover = () => {