everything still works, no 502 and livereload does work, just not for CSS stuff apparently, but for DOM elems we gucci, added a tmp /profile/fetch path and button to the header to test fetching

This commit is contained in:
Me
2022-11-23 03:12:22 +00:00
parent 78687a3daa
commit 9f3dbd4de9
2 changed files with 47 additions and 1 deletions

View File

@@ -26,7 +26,22 @@
console.log('clicked logout header')
$loginStatus = false;
// push('/');
push('/');
};
// TMP for testing Fetch
// let response;
let promise;
let handleClickFetch = async () => {
// await fetch('http://transcendance:8080/api/v2/user')
// .then((res) => {response = res})
// let {data} = await fetch('http://transcendance:8080/api/v2/user');
promise = await fetch('http://transcendance:8080/api/v2/user')
.then( (x) => x.json() );
// there's a () after the .json, duh!!!!
};
</script>
@@ -40,6 +55,11 @@
<h1>Potato Pong</h1>
<!-- {/if} -->
<nav>
<!-- TMP for testing Fetch -->
{#if $location === '/profile/fetch'}
<button on:click={handleClickFetch}>Do a Fetch</button>
{/if}
<!-- <a href=""></a> -->
<!-- i might change these to links rather than buttons, i kinda hate the buttons -->
<!-- maybe just p or div actually idk -->
@@ -53,6 +73,31 @@
</nav>
</header>
<!-- TMP for testing fetch -->
{#if $location === '/profile/fetch'}
<p>Made it to /fetch</p>
<!-- {#if response != undefined} -->
<!-- <p>{response}</p> -->
<!-- <p>{response.json.username}</p> -->
<!-- <p>{response.json}</p> -->
<!-- {/if} -->
{#if promise !== undefined}
<!-- <p>{promise}}</p> -->
<!-- <p>{JSON.stringify(promise, null, 2)}</p> -->
<p>{promise.username}</p>
{/if}
{/if}
<style>
/* See "possible_fonts.css" for more font options... */
@font-face {

View File

@@ -9,6 +9,7 @@ export const prefix = '/profile';
export const profileRoutes = {
'/': ProfileDisplay,
'/settings': ProfileSettings,
'/fetch': ProfileDisplay,
'*': NotFound
};