Fix landpage loading

This commit is contained in:
Michael
2021-08-05 21:48:31 +02:00
parent 62ae8117e6
commit acd964a699
2 changed files with 32 additions and 27 deletions

View File

@@ -16,33 +16,11 @@ import Footer from "./Footer";
import Head from "next/head";
import Nav from "./Nav";
import { ToastContainer } from "react-toastify";
import { supabase } from "utils/supabaseClient";
import { useAuth } from "utils/AuthContext";
import { useEffect } from "react";
const Layout = (props) => {
const { user, signOut } = useAuth();
useEffect(() => {
const { data: authListener } = supabase.auth.onAuthStateChange(
(event, session) => {
if ((event === "SIGNED_OUT") | (event === "SIGNED_IN")) {
fetch("/api/auth", {
method: "POST",
headers: new Headers({ "Content-Type": "application/json" }),
credentials: "same-origin",
body: JSON.stringify({ event, session }),
}).then((res) => res.json());
}
if (event === "USER_UPDATED") {
}
}
);
return () => {
authListener.unsubscribe();
};
}, []);
const toastStyle = {
//Style your toast elements here
success: "bg-accent",