import { cookies } from 'next/headers' /** * Check if the current user is (trying to be) authenticated by * checking if the `payload-token` is present. * * Warning: DO NOT USE THIS FUNCTION TO SECURE PARTS OF THE APPLICATION */ export const isAuthenticated = async (): Promise => { const cookieStore = await cookies(); const token = cookieStore.get("payload-token"); if(typeof token === "undefined") { return false; } return true; }