mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-03-03 18:40:46 +08:00
feat: add google auth integration
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
</div>
|
||||
|
||||
<div class="other-login-page-content">
|
||||
<div class="login-page-button">
|
||||
<div class="login-page-button" @click="loginWithGoogle">
|
||||
<img class="login-page-button-icon" src="../assets/icons/google.svg" alt="Google Logo" />
|
||||
<div class="login-page-button-text">Google 登录</div>
|
||||
</div>
|
||||
@@ -57,6 +57,7 @@
|
||||
<script>
|
||||
import { API_BASE_URL, toast } from '../main'
|
||||
import { setToken } from '../utils/auth'
|
||||
import { googleSignIn } from '../utils/google'
|
||||
export default {
|
||||
name: 'LoginPageView',
|
||||
data() {
|
||||
@@ -87,6 +88,11 @@ export default {
|
||||
} catch (e) {
|
||||
toast.error('登录失败')
|
||||
}
|
||||
},
|
||||
loginWithGoogle() {
|
||||
googleSignIn(() => {
|
||||
this.$router.push('/')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
</div>
|
||||
|
||||
<div class="other-signup-page-content">
|
||||
<div class="signup-page-button">
|
||||
<div class="signup-page-button" @click="signupWithGoogle">
|
||||
<img class="signup-page-button-icon" src="../assets/icons/google.svg" alt="Google Logo" />
|
||||
<div class="signup-page-button-text">Google 注册</div>
|
||||
</div>
|
||||
@@ -101,6 +101,7 @@
|
||||
|
||||
<script>
|
||||
import { API_BASE_URL, toast } from '../main'
|
||||
import { googleSignIn } from '../utils/google'
|
||||
export default {
|
||||
name: 'SignupPageView',
|
||||
|
||||
@@ -187,6 +188,11 @@ export default {
|
||||
} catch (e) {
|
||||
toast.error('注册失败')
|
||||
}
|
||||
},
|
||||
signupWithGoogle() {
|
||||
googleSignIn(() => {
|
||||
this.$router.push('/')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user