diff --git a/src/front/Nav.tsx b/src/front/Nav.tsx index 9b7a1aa..43ec418 100644 --- a/src/front/Nav.tsx +++ b/src/front/Nav.tsx @@ -1,27 +1,43 @@ -import React, { ReactElement, useEffect, useState } from "react"; +import axios from "axios"; +import React, { ReactElement } from "react"; import "./styles/nav.scss"; interface Props { isLogged: boolean; + logoutState: () => void; } const NOT_LOGGED = [ { name: "aplikacja", href: "/" }, { name: "logowanie", href: "login.html" }, + { name: "rejestracja", href: "register.html" }, ]; -const LOGGED = [ - { name: "aplikacja", href: "/" }, - { name: "wyloguj", href: "login.html" }, -]; -function Nav({ isLogged }: Props): ReactElement { +const LOGGED = [{ name: "aplikacja", href: "/" }]; + +function Nav({ isLogged, logoutState }: Props): ReactElement { + const logout = async () => { + await axios.delete( + "http://localhost:8080/api/v1/collections/sessions/current" + ); + logoutState(); + }; + return (