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

Commit

Permalink
feat: auth/session API call temporary at Navbar component. (#379)
Browse files Browse the repository at this point in the history
fixes #366
  • Loading branch information
janie-lee-developer authored Oct 20, 2022
1 parent 0db09db commit 841b635
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/PrimaryNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { supabase } from "../lib/supabase";

import RepoSubmission from "./RepoSubmission";

import { useState } from "react";
import { useState, useEffect } from "react";

const bugReportLink =
"https://github.com/open-sauced/hot/issues/new?assignees=&labels=%F0%9F%91%80+needs+triage%2C%F0%9F%90%9B+bug&template=bug_report.yml&title=Bug%3A+";
Expand All @@ -36,6 +36,18 @@ const PrimaryNav = (): JSX.Element => {

const handleFormOpen = (state: boolean) => setIsFormOpen(state);

useEffect(() => {
const fetchAuthSession = async () => {
if (currentUser?.access_token) {
await fetch(`${import.meta.env.VITE_API_URL}/auth/session`, { headers: { accept: "application/json", Authorization: `Bearer ${currentUser.access_token}` } })
.then(res => console.log("response: ", res))
.catch(err => console.log("error: ", err));
}
};

fetchAuthSession().catch(err => console.log(err));
}, [user]);

return (
<header>
<div className="flex font-OpenSans py-6 px-10 justify-between max-w-screen-2xl mx-auto">
Expand Down

0 comments on commit 841b635

Please sign in to comment.