mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-28 17:10:48 +08:00
feat: add GitHub OAuth login
This commit is contained in:
32
open-isle-cli/src/views/GithubCallbackPageView.vue
Normal file
32
open-isle-cli/src/views/GithubCallbackPageView.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<div class="loading">GitHub 登录中...</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { githubExchange } from '../utils/github'
|
||||
|
||||
export default {
|
||||
name: 'GithubCallbackPageView',
|
||||
async mounted() {
|
||||
const url = new URL(window.location.href)
|
||||
const code = url.searchParams.get('code')
|
||||
const state = url.searchParams.get('state')
|
||||
const result = await githubExchange(code, state, '')
|
||||
if (result === 'NEED_REASON') {
|
||||
this.$router.push('/signup-reason?github=1')
|
||||
} else {
|
||||
this.$router.push('/')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.loading {
|
||||
height: calc(100vh - var(--header-height));
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 20px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user