ktvmanager/client/src/checkAuth.js

19 lines
365 B
JavaScript
Raw Normal View History

2021-02-27 10:56:38 +00:00
import axios from "axios";
async function readCookie() {
try {
2021-03-12 18:44:42 +00:00
const res = await axios.get("http://vps.k-world.me.uk:3001/readCookie");
2021-03-12 13:56:26 +00:00
console.log('IM CHECKING AUTH')
2021-02-27 10:56:38 +00:00
if (res.data === "No Cookie Set") {
2021-03-12 13:56:26 +00:00
console.log('I CHECKED AUTH')
2021-02-27 10:56:38 +00:00
document.location = "/";
}
} catch (e) {
console.log(e);
}
};
export default readCookie;