Update to make standardized API endpoints

This commit is contained in:
Ada Werefox 2025-04-24 15:08:25 -07:00
parent 8e45f66786
commit 7457b39774
4 changed files with 4 additions and 7 deletions

View file

@ -12,7 +12,7 @@
</div> </div>
<a <a
class="flex w-full p-2 font-mono text-lg md:p-4 md:text-2xl bg-secondary ring-2 ring-secondary/80 h-fit0 hover:bg-secondary/50" class="flex w-full p-2 font-mono text-lg md:p-4 md:text-2xl bg-secondary ring-2 ring-secondary/80 h-fit0 hover:bg-secondary/50"
href="http://localhost:31337/login" href="http://localhost:31337/auth/login"
> >
<div class="w-full h-full text-center bg-primary"> <div class="w-full h-full text-center bg-primary">
<p class="drop-shadow-accent drop-shadow-md">Login with Discord</p> <p class="drop-shadow-accent drop-shadow-md">Login with Discord</p>

View file

@ -1,11 +1,10 @@
export function isLoggedIn(): Promise<boolean> { export function isLoggedIn(): Promise<boolean> {
return fetch('http://localhost:31337/authorized', { return fetch('http://localhost:31337/get/user/authorized', {
credentials: 'include', credentials: 'include',
}) })
.then((res) => { .then((res) => {
return res.json().then((res_json) => { return res.json().then((res_json) => {
const is_authorized = res_json.message const is_authorized = res_json.message
console.log('whwhwhw' + is_authorized)
return Boolean(is_authorized) return Boolean(is_authorized)
}) })
}) })

View file

@ -9,19 +9,17 @@ export const user_store = reactive({
}) })
export function update_info() { export function update_info() {
fetch('http://localhost:31337/dashboard', { fetch('http://localhost:31337/get/user/info', {
credentials: 'include', credentials: 'include',
}) })
.then((res) => { .then((res) => {
res res
.json() .json()
.then((userjson) => { .then((userjson) => {
console.log(userjson)
user_store.avatar_decoration = user_store.avatar_decoration =
'https://cdn.discordapp.com/avatar-decoration-presets/' + 'https://cdn.discordapp.com/avatar-decoration-presets/' +
userjson.avatar_decoration_data.asset + userjson.avatar_decoration_data.asset +
'.png' '.png'
console.log(user_store)
user_store.avatar = user_store.avatar =
'https://cdn.discordapp.com/avatars/' + userjson.id + '/' + userjson.avatar + '.png' 'https://cdn.discordapp.com/avatars/' + userjson.id + '/' + userjson.avatar + '.png'
user_store.id = 'https://discord.com/users/' + userjson.id user_store.id = 'https://discord.com/users/' + userjson.id

View file

@ -26,7 +26,7 @@ onMounted(update_info)
</div> </div>
<a <a
class="flex w-full p-2 font-mono text-lg md:p-4 md:text-2xl bg-secondary ring-2 ring-secondary/80 h-fit0 hover:bg-secondary/50" class="flex w-full p-2 font-mono text-lg md:p-4 md:text-2xl bg-secondary ring-2 ring-secondary/80 h-fit0 hover:bg-secondary/50"
href="http://localhost:31337/logout" href="http://localhost:31337/auth/logout"
> >
<div class="w-full h-full text-center bg-primary"> <div class="w-full h-full text-center bg-primary">
<p class="drop-shadow-accent drop-shadow-md">Logout</p> <p class="drop-shadow-accent drop-shadow-md">Logout</p>