flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/apps/web/app/routes/logout.tsx

19 lines565 bytesCodeBlame
1import { redirect } from "react-router";
2
3import type { Route } from "./+types/logout";
4import { assertSameOrigin, endSession, nextPath } from "../lib/session.server";
5
6/**
7 * Signs out, then goes home, or to `next` (a path on g1t only): "Switch
8 * account" signs out to the sign-in page, which brings them back.
9 */
10export async function action({ request }: Route.ActionArgs) {
11 assertSameOrigin(request);
12 throw redirect(nextPath(request), {
13 headers: { "set-cookie": await endSession(request) },
14 });
15}
16
17export function loader() {
18 throw redirect("/");
19}