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:
@@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
import { replace } from "svelte-spa-router";
|
import { replace } from "svelte-spa-router";
|
||||||
|
|
||||||
|
export let user;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<h1>You made it to Test</h1>
|
<h1>You made it to Test</h1>
|
||||||
<button on:click={ () => (replace('/'))}>Go Home</button>
|
<button on:click={ () => (replace('/'))}>Go Home</button>
|
||||||
|
<div>{user}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { push } from "svelte-spa-router";
|
import { push } from "svelte-spa-router";
|
||||||
import { userStore, userLogout } from "../../old_unused/loginStatusStore";
|
|
||||||
|
|
||||||
// onMount( async() => {
|
// onMount( async() => {
|
||||||
// await fetch("http://transcendance:8080/api/v2/auth/2fa/generate",
|
// await fetch("http://transcendance:8080/api/v2/auth/2fa/generate",
|
||||||
|
|||||||
@@ -54,13 +54,17 @@
|
|||||||
|
|
||||||
// I don't really care which i use at this point...
|
// I don't really care which i use at this point...
|
||||||
// if (set.username === nameTmp) {
|
// 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';
|
errors.username = 'Invalid new username';
|
||||||
valid = false;
|
valid = false;
|
||||||
} else {
|
} else {
|
||||||
errors.username = '';
|
errors.username = '';
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
}
|
||||||
|
if (set.username === '') {
|
||||||
|
set.username === nameTmp;
|
||||||
|
// set.username === user.username;
|
||||||
|
}
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
await fetch('http://transcendance:8080/api/v2/user',{
|
await fetch('http://transcendance:8080/api/v2/user',{
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import UnauthorizedAccessPage from '../pages/UnauthorizedAccessPage.svelte';
|
|||||||
import { wrap } from 'svelte-spa-router/wrap'
|
import { wrap } from 'svelte-spa-router/wrap'
|
||||||
import { get } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
import TestPage from '../pages/TmpTestPage.svelte';
|
import TestPage from '../pages/TmpTestPage.svelte';
|
||||||
import { userStore, userLogout } from "../stores/loginStatusStore";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -141,7 +140,10 @@ export const primaryRoutes = {
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
// props: {
|
||||||
|
// user: user
|
||||||
|
// }
|
||||||
}),
|
}),
|
||||||
'/profile': wrap({
|
'/profile': wrap({
|
||||||
component: ProfilePage,
|
component: ProfilePage,
|
||||||
|
|||||||
Reference in New Issue
Block a user