ok now it actually works, had a few imports left over that i needed to get rid of, also added extra protection in my ProfileSettings so you can not change the username and it's still ok

This commit is contained in:
Me
2022-12-07 19:20:55 +01:00
parent 59bc893173
commit 3cdedc921c
4 changed files with 12 additions and 4 deletions

View File

@@ -2,11 +2,14 @@
import { replace } from "svelte-spa-router";
export let user;
</script>
<div class="wrapper">
<h1>You made it to Test</h1>
<button on:click={ () => (replace('/'))}>Go Home</button>
<div>{user}</div>
</div>
<style>

View File

@@ -1,7 +1,6 @@
<script lang="ts">
import { onMount } from "svelte";
import { push } from "svelte-spa-router";
import { userStore, userLogout } from "../../old_unused/loginStatusStore";
// onMount( async() => {
// await fetch("http://transcendance:8080/api/v2/auth/2fa/generate",

View File

@@ -54,13 +54,17 @@
// I don't really care which i use at this point...
// if (set.username === nameTmp) {
if (set.username === user.username || (set.username.trim() === '' && set.username !== '')) {
if (set.username === user.username || (set.username !== '' && set.username.trim() === '')) {
errors.username = 'Invalid new username';
valid = false;
} else {
errors.username = '';
valid = true;
}
if (set.username === '') {
set.username === nameTmp;
// set.username === user.username;
}
if (valid) {
await fetch('http://transcendance:8080/api/v2/user',{

View File

@@ -6,7 +6,6 @@ import UnauthorizedAccessPage from '../pages/UnauthorizedAccessPage.svelte';
import { wrap } from 'svelte-spa-router/wrap'
import { get } from 'svelte/store';
import TestPage from '../pages/TmpTestPage.svelte';
import { userStore, userLogout } from "../stores/loginStatusStore";
@@ -141,7 +140,10 @@ export const primaryRoutes = {
else
return false;
}
]
],
// props: {
// user: user
// }
}),
'/profile': wrap({
component: ProfilePage,