ktvmanager/client/src/checkAuth.js
2021-03-18 10:50:15 +00:00

19 lines
392 B
JavaScript

import axios from "axios";
async function readCookie() {
try {
const res = await axios.get("http://vps.k-world.me.uk:3001/readCookie", { withCredentials: true });
console.log('IM CHECKING AUTH')
if (res.data === "No Cookie Set") {
console.log('I CHECKED AUTH')
document.location = "/";
}
} catch (e) {
console.log(e);
}
};
export default readCookie;