fix: setup 迁移完成 v1

This commit is contained in:
Tim
2025-08-14 10:27:01 +08:00
parent 902fce5174
commit 655e8f2a65
33 changed files with 289 additions and 393 deletions

View File

@@ -2,29 +2,25 @@
<CallbackPage />
</template>
<script>
<script setup>
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')
}
},
}
onMounted(async () => {
const hash = new URLSearchParams(window.location.hash.substring(1))
const idToken = hash.get('id_token')
if (idToken) {
await googleAuthWithToken(
idToken,
() => {
navigateTo('/', { replace: true })
},
(token) => {
navigateTo(`/signup-reason?token=${token}`, { replace: true })
},
)
} else {
navigateTo('/login', { replace: true })
}
})
</script>