dont rely on cookie

This commit is contained in:
Karol Wypchlo 2020-12-16 18:25:34 +01:00
parent c806129ba7
commit 50975b0c5e
1 changed files with 7 additions and 21 deletions

View File

@ -1,12 +1,9 @@
import React from "react"; import React from "react";
import Cookies from "js-cookie";
import logo from "../../images/logo.svg"; import logo from "../../images/logo.svg";
import "./HomeTop.scss"; import "./HomeTop.scss";
import { Skynet, Deco1, Deco2 } from "../../svg"; import { Skynet, Deco1, Deco2 } from "../../svg";
export default function HomeTop() { export default function HomeTop() {
const authenticated = Boolean(Cookies.get("skynet-jwt"));
return ( return (
<div className="home-top"> <div className="home-top">
<img src={logo} alt="Skynet logo" className="logo" /> <img src={logo} alt="Skynet logo" className="logo" />
@ -19,24 +16,13 @@ export default function HomeTop() {
</p> </p>
<p className="auth-links"> <p className="auth-links">
{authenticated ? ( <a href="/secure/auth/registration" className="link">
<> Sign up now!
Welcome back! Go to your{" "} </a>{" "}
<a href="/secure/" className="link"> | Already have an account? Go to your{" "}
dashboard <a href="/secure/auth/login" className="link">
</a> dashboard
</> </a>
) : (
<>
<a href="/secure/auth/registration" className="link">
Sign up now!
</a>{" "}
Already have an account?{" "}
<a href="/secure/auth/login" className="link">
Log in!
</a>
</>
)}
</p> </p>
<Deco1 className="deco-1" /> <Deco1 className="deco-1" />