This commit is contained in:
parent
c200f2e748
commit
83e10da103
|
|
@ -5,7 +5,8 @@ import PayPage from './pages/PayPage.tsx'
|
||||||
import PayResultPage from './pages/PayResultPage.tsx'
|
import PayResultPage from './pages/PayResultPage.tsx'
|
||||||
import Twins from './pages/Twins.tsx'
|
import Twins from './pages/Twins.tsx'
|
||||||
import PlaceholderPage from './components/PlaceholderPage.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
|
// http://localhost:5173?token=c3f52a99-c519-427a-af05-364c5f3e59cc
|
||||||
function App() {
|
function App() {
|
||||||
|
|
@ -25,6 +26,12 @@ function App() {
|
||||||
navigate('/twins', { replace: true })
|
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()
|
const { data: packageInfo } = await getPackage()
|
||||||
|
|
||||||
if (isMounted) {
|
if (isMounted) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { getConfig, getService } from '@/api/user'
|
import { getService } from '@/api/user'
|
||||||
import { TEMP_TOKEN_STORAGE_KEY } from '@/utils/request'
|
|
||||||
|
|
||||||
type TwinsProps = {
|
type TwinsProps = {
|
||||||
installUrl: string
|
installUrl: string
|
||||||
|
|
@ -14,12 +13,6 @@ function Twins({ installUrl }: TwinsProps) {
|
||||||
|
|
||||||
async function initTwinsConfig() {
|
async function initTwinsConfig() {
|
||||||
try {
|
try {
|
||||||
const { data: config } = await getConfig()
|
|
||||||
|
|
||||||
if (config.token) {
|
|
||||||
window.sessionStorage.setItem(TEMP_TOKEN_STORAGE_KEY, config.token)
|
|
||||||
}
|
|
||||||
|
|
||||||
const { data: service } = await getService()
|
const { data: service } = await getService()
|
||||||
const nextServiceUrl = service['kf.address']
|
const nextServiceUrl = service['kf.address']
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue