feat(api): add api endpoint to log user out

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2023-10-10 22:08:47 -04:00
parent 6f770a1cb8
commit 83d1e97f49
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

View File

@ -0,0 +1,10 @@
export default eventHandler(async (ev) => {
if (ev.context.currentUser) {
deleteCookie(ev, "auth:token");
ev.context.currentUser = undefined;
return {
success: true,
};
}
throw createError({ statusCode: 400, message: "Not logged in" });
});