This commit is contained in:
zhangjianjun 2026-07-20 11:57:08 +08:00
parent c200f2e748
commit 83e10da103
2 changed files with 9 additions and 9 deletions

View File

@ -5,7 +5,8 @@ import PayPage from './pages/PayPage.tsx'
import PayResultPage from './pages/PayResultPage.tsx'
import Twins from './pages/Twins.tsx'
import PlaceholderPage from './components/PlaceholderPage.tsx'
import { getPackage } from './api/user.ts'
import { getConfig, getPackage } from './api/user.ts'
import { TEMP_TOKEN_STORAGE_KEY } from './utils/request.ts'
// http://localhost:5173?token=c3f52a99-c519-427a-af05-364c5f3e59cc
function App() {
@ -25,6 +26,12 @@ function App() {
navigate('/twins', { replace: true })
}
const { data: config } = await getConfig()
if (config.token) {
window.sessionStorage.setItem(TEMP_TOKEN_STORAGE_KEY, config.token)
}
const { data: packageInfo } = await getPackage()
if (isMounted) {

View File

@ -1,6 +1,5 @@
import { useEffect, useState } from 'react'
import { getConfig, getService } from '@/api/user'
import { TEMP_TOKEN_STORAGE_KEY } from '@/utils/request'
import { getService } from '@/api/user'
type TwinsProps = {
installUrl: string
@ -14,12 +13,6 @@ function Twins({ installUrl }: TwinsProps) {
async function initTwinsConfig() {
try {
const { data: config } = await getConfig()
if (config.token) {
window.sessionStorage.setItem(TEMP_TOKEN_STORAGE_KEY, config.token)
}
const { data: service } = await getService()
const nextServiceUrl = service['kf.address']