mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-25 23:50:51 +08:00
feat: 推送链路调整
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { API_BASE_URL, DISCORD_CLIENT_ID, toast } from '../main'
|
||||
import { WEBSITE_BASE_URL } from '../constants'
|
||||
import { setToken, loadCurrentUser } from './auth'
|
||||
import { registerPush } from './push'
|
||||
|
||||
export function discordAuthorize(state = '') {
|
||||
if (!DISCORD_CLIENT_ID) {
|
||||
@@ -24,6 +25,7 @@ export async function discordExchange(code, state, reason) {
|
||||
setToken(data.token)
|
||||
await loadCurrentUser()
|
||||
toast.success('登录成功')
|
||||
registerPush()
|
||||
return {
|
||||
success: true,
|
||||
needReason: false
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { API_BASE_URL, GITHUB_CLIENT_ID, toast } from '../main'
|
||||
import { setToken, loadCurrentUser } from './auth'
|
||||
import { WEBSITE_BASE_URL } from '../constants'
|
||||
import { registerPush } from './push'
|
||||
|
||||
export function githubAuthorize(state = '') {
|
||||
if (!GITHUB_CLIENT_ID) {
|
||||
@@ -24,6 +25,7 @@ export async function githubExchange(code, state, reason) {
|
||||
setToken(data.token)
|
||||
await loadCurrentUser()
|
||||
toast.success('登录成功')
|
||||
registerPush()
|
||||
return {
|
||||
success: true,
|
||||
needReason: false
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { API_BASE_URL, GOOGLE_CLIENT_ID, toast } from '../main'
|
||||
import { setToken, loadCurrentUser } from './auth'
|
||||
import { registerPush } from './push'
|
||||
|
||||
export async function googleGetIdToken() {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -29,6 +30,7 @@ export async function googleAuthWithToken(idToken, redirect_success, redirect_no
|
||||
setToken(data.token)
|
||||
await loadCurrentUser()
|
||||
toast.success('登录成功')
|
||||
registerPush()
|
||||
if (redirect_success) redirect_success()
|
||||
} else if (data.reason_code === 'NOT_APPROVED') {
|
||||
toast.info('当前为注册审核模式,请填写注册理由')
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { API_BASE_URL, TWITTER_CLIENT_ID, toast } from '../main'
|
||||
import { WEBSITE_BASE_URL } from '../constants'
|
||||
import { setToken, loadCurrentUser } from './auth'
|
||||
import { registerPush } from './push'
|
||||
|
||||
function generateCodeVerifier() {
|
||||
const array = new Uint8Array(32)
|
||||
@@ -59,6 +60,7 @@ export async function twitterExchange(code, state, reason) {
|
||||
setToken(data.token)
|
||||
await loadCurrentUser()
|
||||
toast.success('登录成功')
|
||||
registerPush()
|
||||
return { success: true, needReason: false }
|
||||
} else if (data.reason_code === 'NOT_APPROVED') {
|
||||
toast.info('当前为注册审核模式,请填写注册理由')
|
||||
|
||||
Reference in New Issue
Block a user