Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
feat: logout route
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonHowe committed Jul 4, 2020
1 parent 8d397a0 commit 4ed724f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/api/src/modules/auth/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { loginBody } from "./schema/loginBody";
import findUser from "../users/actions/findUser";
import { LoginBody } from "./types/LoginBody";
import { HttpError } from "../../common/error/classes/httpError";
import { requireAuthenticated } from "./middleware/requireAuthenticated";

const router = new Router({ prefix: "/auth" });

Expand Down Expand Up @@ -40,4 +41,13 @@ router.post(
}
);

router.post("/logout", requireAuthenticated(), async (ctx, next) => {
ctx.session = null;

ctx.status = 200;
ctx.body = "Successfully logged out";

await next();
});

export default router.routes();

0 comments on commit 4ed724f

Please sign in to comment.