mirror of
https://github.com/luxfi/bridge.git
synced 2026-09-24 00:26:46 +00:00
Fix auth page: remove async server-side calls from client component
This commit is contained in:
@@ -2,43 +2,20 @@
|
||||
|
||||
import React from 'react'
|
||||
import AuthWizard from '@/components/Wizard/AuthWizard'
|
||||
import getBridgeSettings from '@/util/getBridgeSettings'
|
||||
import { redirect } from 'next/navigation'
|
||||
import { useSettingsContainer } from '@/context/settings'
|
||||
import { FormWizardProvider } from '@/context/formWizardProvider'
|
||||
import { AuthStep } from '@/Models/Wizard'
|
||||
import { SwapDataProvider } from '@/context/swap'
|
||||
import { BridgeAppSettings } from '@/Models/BridgeAppSettings'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
const AuthPage = async () => {
|
||||
try {
|
||||
const settings = await getBridgeSettings()
|
||||
const settingsContainer = useSettingsContainer()
|
||||
|
||||
// if (!settings && 'error' in settings && settings.error.startsWith('invalid guid')) {
|
||||
if (!settings) {
|
||||
redirect('/')
|
||||
}
|
||||
|
||||
if (settingsContainer) {
|
||||
settingsContainer.settings = new BridgeAppSettings(
|
||||
settings && 'networks' in settings ? settings : {}
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<SwapDataProvider>
|
||||
<FormWizardProvider initialStep={AuthStep.Email} initialLoading={false}>
|
||||
<AuthWizard />
|
||||
</FormWizardProvider>
|
||||
</SwapDataProvider>
|
||||
)
|
||||
} catch (e) {
|
||||
console.error('Error in AuthPage:', e)
|
||||
return null
|
||||
}
|
||||
const AuthPage = () => {
|
||||
return (
|
||||
<SwapDataProvider>
|
||||
<FormWizardProvider initialStep={AuthStep.Email} initialLoading={false}>
|
||||
<AuthWizard />
|
||||
</FormWizardProvider>
|
||||
</SwapDataProvider>
|
||||
)
|
||||
}
|
||||
|
||||
export default AuthPage
|
||||
|
||||
Reference in New Issue
Block a user