Skip to content

Commit

Permalink
log out hot fix
Browse files Browse the repository at this point in the history
  • Loading branch information
potts99 committed Nov 28, 2023
1 parent ce4b82d commit ccf7546
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions apps/client/layouts/newLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
HomeIcon,
XMarkIcon,
} from "@heroicons/react/24/outline";
import { deleteCookie } from "cookies-next";
import { deleteCookie, getCookie } from "cookies-next";
import Link from "next/link";
import { useRouter } from "next/router";
import { Fragment, useCallback, useEffect, useState } from "react";
Expand Down Expand Up @@ -90,7 +90,14 @@ export default function NewLayout({ children }: any) {
async function logout() {
// clears session on server
const res = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/api/v1/auth/user/${user.id}/logout`
`${process.env.NEXT_PUBLIC_API_URL}/api/v1/auth/user/${user.id}/logout`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${getCookie("session")}`,
},
}
).then((res) => res.json());

// delete session cookie
Expand Down

0 comments on commit ccf7546

Please sign in to comment.