From 8dce7f4a4d17f06f4395cdefe743dc79c6cd9b7c Mon Sep 17 00:00:00 2001 From: TheClashFruit Date: Thu, 24 Aug 2023 16:48:26 +0200 Subject: [PATCH] feat: test --- index.html | 19 ++++++++----------- js/auth.js | 2 ++ js/main.js | 12 +++++++++++- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index b671553..670a758 100644 --- a/index.html +++ b/index.html @@ -9,8 +9,6 @@ - -
@@ -55,20 +53,17 @@ Login +
  • + + $userName + +
  • - + CONTENT HERE
    + + \ No newline at end of file diff --git a/js/auth.js b/js/auth.js index 4e411b1..e6fefae 100644 --- a/js/auth.js +++ b/js/auth.js @@ -12,5 +12,7 @@ if(typeof authCode !== undefined) { .then(res => { localStorage.setItem('token', res.access_token) localStorage.setItem('refresh', res.refresh_token) + + document.location = "/" }) } \ No newline at end of file diff --git a/js/main.js b/js/main.js index 3487e39..c16db11 100644 --- a/js/main.js +++ b/js/main.js @@ -1,3 +1,5 @@ +const $ = _ => document.querySelector(_); + const DiscordApi = { getUser: async () => { if (typeof localStorage.getItem('token') !== "string") @@ -32,4 +34,12 @@ const DiscordApi = { localStorage.setItem('refresh', res.refresh_token) }) } -} \ No newline at end of file +} + +const displayUser = async () => { + const user = await DiscordApi.getUser() + + $('.userButton').innerText = user.display_name +} + +displayUser(); \ No newline at end of file