Fix callback redirect

This commit is contained in:
2025-01-12 00:16:31 +01:00
parent 8551327bf0
commit 9dfaa38aa5

View File

@@ -1,5 +1,5 @@
import { createApp, ref, onMounted } from 'vue'; import { createApp, ref, onMounted } from 'vue';
import { createRouter, createWebHistory, RouterView } from 'vue-router'; import { createRouter, createWebHistory, RouterView, useRouter } from 'vue-router';
const Authorize = { const Authorize = {
@@ -57,13 +57,15 @@ const Main = {
const AuthCallbackTwitch = { const AuthCallbackTwitch = {
setup() { setup() {
const router = useRouter();
onMounted(() => { onMounted(() => {
fetch('/api/auth/callback/twitch/' + window.location.search) fetch('/api/auth/callback/twitch/' + window.location.search)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
localStorage.setItem('token', data.token); localStorage.setItem('token', data.token);
this.$router.push('/'); router.push('/');
}); });
}); });
}, },