Improved it a tad bit more
This commit is contained in:
@@ -9,13 +9,7 @@ const auth = getAuth(app);
|
||||
export default withIronSessionApiRoute(logout, sessionOptions);
|
||||
|
||||
async function logout(req: NextApiRequest, res: NextApiResponse) {
|
||||
signOut(auth)
|
||||
.then(() => {
|
||||
req.session.destroy();
|
||||
res.status(200).json({ok: true});
|
||||
})
|
||||
.catch(() => {
|
||||
req.session.destroy();
|
||||
res.status(500).json({ok: false});
|
||||
});
|
||||
await auth.signOut();
|
||||
req.session.destroy();
|
||||
res.status(200).json(undefined);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user