mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-06 10:07:36 +08:00
chore: migrate legacy pages and utilities to nuxt
This commit is contained in:
27
frontend_nuxt/pages/google-callback.vue
Normal file
27
frontend_nuxt/pages/google-callback.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<CallbackPage />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CallbackPage from '../components/CallbackPage.vue'
|
||||
import { googleAuthWithToken } from '../utils/google'
|
||||
|
||||
export default {
|
||||
name: 'GoogleCallbackPageView',
|
||||
components: { CallbackPage },
|
||||
async mounted() {
|
||||
const hash = new URLSearchParams(window.location.hash.substring(1))
|
||||
const idToken = hash.get('id_token')
|
||||
if (idToken) {
|
||||
await googleAuthWithToken(idToken, () => {
|
||||
this.$router.push('/')
|
||||
}, token => {
|
||||
this.$router.push('/signup-reason?token=' + token)
|
||||
})
|
||||
} else {
|
||||
this.$router.push('/login')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user