import logoutUser from "@/src/functions/auth/logout-user";
import Layout from "@/src/layouts/login";
import H2 from "@/twui/components/layout/H2";
import { GetServerSideProps } from "next";

export default function LogoutPage() {
    return (
        <Layout>
            <H2>Loging out ...</H2>
        </Layout>
    );
}

export const getServerSideProps: GetServerSideProps = async (ctx) => {
    await logoutUser({
        res: ctx.res,
        req: ctx.req,
    });

    return {
        redirect: {
            destination: `/auth/login`,
            statusCode: 307,
        },
    };
};
