fix mini app bot father
This commit is contained in:
@@ -1,20 +1,40 @@
|
||||
import { Suspense } from 'react';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { BotManageMiniAppContent } from './content';
|
||||
'use client';
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
function BotManageLegacyRedirectContent() {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const botId = searchParams.get('botId');
|
||||
|
||||
useEffect(() => {
|
||||
const target = botId
|
||||
? `/mini-apps/bot-father?botId=${encodeURIComponent(botId)}`
|
||||
: '/mini-apps/bot-father';
|
||||
router.replace(target);
|
||||
}, [botId, router]);
|
||||
|
||||
function BotManageFallback() {
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center p-6 text-sm text-[#667085]">
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||
Загрузка Mini App...
|
||||
Перенаправление...
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function BotManageMiniAppPage() {
|
||||
export default function BotManageLegacyRedirectPage() {
|
||||
return (
|
||||
<Suspense fallback={<BotManageFallback />}>
|
||||
<BotManageMiniAppContent />
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="flex min-h-screen items-center justify-center p-6 text-sm text-[#667085]">
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<BotManageLegacyRedirectContent />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user