|
@@ -6,14 +6,10 @@
|
|
|
|
|
|
|
|
let isAuthenticated = false;
|
|
let isAuthenticated = false;
|
|
|
let isLoading = true;
|
|
let isLoading = true;
|
|
|
- let user = null;
|
|
|
|
|
let showPassword = false;
|
|
let showPassword = false;
|
|
|
|
|
|
|
|
$: authentication.subscribe((value) => {
|
|
$: authentication.subscribe((value) => {
|
|
|
isAuthenticated = !!value;
|
|
isAuthenticated = !!value;
|
|
|
- if (value) {
|
|
|
|
|
- user = value;
|
|
|
|
|
- }
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
onMount(() => {
|
|
onMount(() => {
|
|
@@ -71,10 +67,6 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function logout() {
|
|
|
|
|
- window.location.href = '/logout';
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
function navigateToRegister() {
|
|
function navigateToRegister() {
|
|
|
window.location.href = '/register';
|
|
window.location.href = '/register';
|
|
|
}
|
|
}
|
|
@@ -117,9 +109,6 @@
|
|
|
<button type="button" class="register-button" on:click={navigateToRegister}>Register</button>
|
|
<button type="button" class="register-button" on:click={navigateToRegister}>Register</button>
|
|
|
</form>
|
|
</form>
|
|
|
</div>
|
|
</div>
|
|
|
- {:else}
|
|
|
|
|
- <p>You are logged in as {user.username}!</p>
|
|
|
|
|
- <button class="logout-button" on:click={logout}>Logout</button>
|
|
|
|
|
{/if}
|
|
{/if}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -151,8 +140,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.add-button,
|
|
.add-button,
|
|
|
- .register-button,
|
|
|
|
|
- .logout-button {
|
|
|
|
|
|
|
+ .register-button {
|
|
|
padding: 0.5rem 1rem;
|
|
padding: 0.5rem 1rem;
|
|
|
margin-top: 0.5rem;
|
|
margin-top: 0.5rem;
|
|
|
border: none;
|
|
border: none;
|
|
@@ -171,9 +159,4 @@
|
|
|
background-color: #2196f3;
|
|
background-color: #2196f3;
|
|
|
color: white;
|
|
color: white;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- .logout-button {
|
|
|
|
|
- background-color: #f44336;
|
|
|
|
|
- color: white;
|
|
|
|
|
- }
|
|
|
|
|
</style>
|
|
</style>
|