Add an /api/authcheck and use it to toggle logout/login link on top header.
This commit is contained in:
parent
c2123ff741
commit
fcb71add03
3 changed files with 15 additions and 2 deletions
|
|
@ -16,7 +16,8 @@
|
|||
<title>ZedShaw.games</title>
|
||||
</head>
|
||||
<body id="top" data-testid="{{.PageId}}">
|
||||
<header>
|
||||
<header x-data="{auth: false}"
|
||||
x-init="auth = await GetJson('/api/authcheck')">
|
||||
<nav>
|
||||
<a id="home" href="/">
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
|
|
@ -30,7 +31,12 @@
|
|||
<a id="stream" href="/stream/">Streams</a>
|
||||
<a id="game" href="/game/">Games</a>
|
||||
<a id="register" href="/register/">Register</a>
|
||||
<a id="login" href="/login/">Login</a>
|
||||
<template x-if="auth.is_authed">
|
||||
<a id="logout" href="/api/logout">Logout</a>
|
||||
</template>
|
||||
<template x-if="!auth.is_authed">
|
||||
<a id="login" href="/login/">Login</a>
|
||||
</template>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue