Skip to content

Commit

Permalink
swap from withCredentials - true, to credentials include. Fixed cooki…
Browse files Browse the repository at this point in the history
…e removal issue
  • Loading branch information
ian-flynn committed Jul 28, 2023
1 parent e1ab005 commit 730e8f3
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/components/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,17 @@ import logo from '../images/JunoSurfLogo.png';
import Login from './Login.jsx';

const NavBar = ({ user, setUser }) => {
// const [menuOpen, setMenuOpen] = useState(false);
//create onclick function that opens google oauth modal
const googleLogin = () => {
window.open('http://localhost:3000/auth/google', '_self');
};
const googleLogout = async () => {
console.log('starting logout');
const res = await fetch('http://localhost:3000/auth/logout', {
method: 'POST',
withCredentials: true,
credentials: 'include',
});
console.log('RESPONSE: ', res);
const data = await res.json();
console.log('DATA: ', data);

if (data === 'logged out') {
setUser(null);
// window.location.reload(true);
window.location.reload(true);
}
};

Expand Down

0 comments on commit 730e8f3

Please sign in to comment.