cpularp-manager-frontend/src/ts/user_info.ts

29 lines
810 B
TypeScript
Raw Normal View History

import { reactive } from 'vue'
export const user_store = reactive({
Avatar_Decoration: '',
Avatar: '',
Id: '',
Global_Name: '',
Username: '',
})
export function update_info() {
fetch('http://localhost:31337/dashboard', {
credentials: 'include',
}).then((res) => {
res.json().then((userjson) => {
console.log(userjson)
user_store.Avatar_Decoration =
'https://cdn.discordapp.com/avatar-decoration-presets/' +
userjson.Avatar_Decoration_Data.Asset +
'.png'
user_store.Avatar =
'https://cdn.discordapp.com/avatars/' + userjson.Id + '/' + userjson.Avatar + '.png'
user_store.Id = 'https://discord.com/users/' + userjson.Id
user_store.Global_Name = userjson.Global_Name
user_store.Username = userjson.Username
})
})
}