mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-27 00:20:48 +08:00
Implement registration whitelist flow
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { API_BASE_URL, GOOGLE_CLIENT_ID, toast } from '../main'
|
||||
import { setToken, loadCurrentUser } from './auth'
|
||||
|
||||
export function googleSignIn(redirect) {
|
||||
export function googleSignIn(redirect, reason) {
|
||||
if (!window.google || !GOOGLE_CLIENT_ID) {
|
||||
toast.error('Google 登录不可用')
|
||||
return
|
||||
@@ -13,7 +13,7 @@ export function googleSignIn(redirect) {
|
||||
const res = await fetch(`${API_BASE_URL}/api/auth/google`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ idToken: credential })
|
||||
body: JSON.stringify({ idToken: credential, reason })
|
||||
})
|
||||
const data = await res.json()
|
||||
if (res.ok && data.token) {
|
||||
|
||||
Reference in New Issue
Block a user