feat: test
This commit is contained in:
parent
38cf68a861
commit
8dce7f4a4d
19
index.html
19
index.html
|
@ -9,8 +9,6 @@
|
|||
|
||||
<link rel="icon" href="favicon.ico">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
|
||||
<script src="js/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="pageHero" id="hero">
|
||||
|
@ -55,20 +53,17 @@
|
|||
Login
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="userButton">
|
||||
$userName
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="pageContent" id="content">
|
||||
<script>
|
||||
const usr = async () => {
|
||||
let a = await DiscordApi.getUser()
|
||||
|
||||
document.write(JSON.stringify(a));
|
||||
}
|
||||
|
||||
usr()
|
||||
</script>
|
||||
CONTENT HERE
|
||||
</main>
|
||||
|
||||
<footer class="pageFooter container" id="footer">
|
||||
|
@ -84,5 +79,7 @@
|
|||
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -12,5 +12,7 @@ if(typeof authCode !== undefined) {
|
|||
.then(res => {
|
||||
localStorage.setItem('token', res.access_token)
|
||||
localStorage.setItem('refresh', res.refresh_token)
|
||||
|
||||
document.location = "/"
|
||||
})
|
||||
}
|
10
js/main.js
10
js/main.js
|
@ -1,3 +1,5 @@
|
|||
const $ = _ => document.querySelector(_);
|
||||
|
||||
const DiscordApi = {
|
||||
getUser: async () => {
|
||||
if (typeof localStorage.getItem('token') !== "string")
|
||||
|
@ -33,3 +35,11 @@ const DiscordApi = {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
const displayUser = async () => {
|
||||
const user = await DiscordApi.getUser()
|
||||
|
||||
$('.userButton').innerText = user.display_name
|
||||
}
|
||||
|
||||
displayUser();
|
Loading…
Reference in a new issue