Slight cleanup, fixed router redirects.
This commit is contained in:
parent
426542d4c9
commit
f1f3a9f521
5 changed files with 22 additions and 68 deletions
|
@ -1,25 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Bad Request!</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="description" content="Bad request trying to authenticate Discord oauth">
|
||||
<meta name="keywords" content="HTML, CSS, JavaScript">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/public/css/style.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="bg-gray-200">
|
||||
<div class="min-h-screen">
|
||||
<div class="container max-w-3xl pt-4 pb-4 space-y-4">
|
||||
<h1 class="text-left">Oops!</h1>
|
||||
<p class="text-lg">There was some problem with the authentication process...</p>
|
||||
<p>{{ .message }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,25 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Internal Server Error!</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="description" content="Bad request trying to authenticate Discord oauth">
|
||||
<meta name="keywords" content="HTML, CSS, JavaScript">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/public/css/style.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="bg-gray-200">
|
||||
<div class="min-h-screen">
|
||||
<div class="container max-w-3xl pt-4 pb-4 space-y-4">
|
||||
<h1 class="text-left">Oops!</h1>
|
||||
<p class="text-lg">We experienced some kind of server error...</p>
|
||||
<p>{{ .message }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -11,13 +11,13 @@ const router = createRouter({
|
|||
name: 'home',
|
||||
component: HomeView,
|
||||
beforeEnter: (to) => {
|
||||
isLoggedIn().then((response) => {
|
||||
return isLoggedIn().then((response) => {
|
||||
if (response) {
|
||||
const redirect = to.query.redirect?.toString()
|
||||
if (redirect != undefined) {
|
||||
router.replace(redirect)
|
||||
return redirect
|
||||
} else {
|
||||
router.replace('/dashboard')
|
||||
return '/dashboard'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -35,9 +35,9 @@ const router = createRouter({
|
|||
|
||||
router.beforeEach((to) => {
|
||||
if (to.meta.requiresAuth) {
|
||||
isLoggedIn().then((response) => {
|
||||
return isLoggedIn().then((response) => {
|
||||
if (response == false) {
|
||||
router.replace('/?redirect=' + to.fullPath)
|
||||
return '/?redirect=' + to.fullPath
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -11,18 +11,22 @@ export const user_store = reactive({
|
|||
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
|
||||
})
|
||||
})
|
||||
.then((res) => {
|
||||
res
|
||||
.json()
|
||||
.then((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
|
||||
})
|
||||
.catch(() => {})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue