i created this cookie in node js:
res.cookie('DKNS', username, {maxAge: 10000 });
but it is created in the browser, but I don't know why it is not deleted after 10 seconds, I want it to be deleted after 10 seconds and once it is deleted it will redirect me to my login route, I have this function in javascript that would serve to check if the cookie exists:
function checkCookie(){
if(document.cookie.indexOf("DKNS") == (-1)) {
window.location.replace = "/login";
}
setTimeout(checkCookie, 1000)
}
but it doesn't work can someone help me with this, please?