api update
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { useEffect, useState, Suspense } from "react";
|
||||
import { useEffect, useState, Suspense, lazy } from "react";
|
||||
import { BrowserRouter, Routes, Route } from "react-router-dom";
|
||||
import Profile from "./Profile";
|
||||
import HackGame from "./HackGame";
|
||||
import { TOKEN_KEY } from "./api";
|
||||
import AdminDashboard from "./AdminDashboard";
|
||||
|
||||
const Profile = lazy(() => import("./Profile"));
|
||||
const HackGame = lazy(() => import("./HackGame"));
|
||||
const AdminDashboard = lazy(() => import("./AdminDashboard"));
|
||||
|
||||
function AuthHandler({ children }: { children: React.ReactNode }) {
|
||||
const [isProcessing, setIsProcessing] = useState(true);
|
||||
|
||||
@@ -199,9 +199,9 @@ export default function Profile() {
|
||||
const handleTrial = async () => {
|
||||
try {
|
||||
await activateTrial();
|
||||
window.location.reload();
|
||||
const newData = await fetchProfile();
|
||||
setData(newData);
|
||||
} catch (e: any) {
|
||||
// 🔥 ИСПРАВЛЕНО: Вывод реальной ошибки с бэкенда
|
||||
alert(`[ERROR] ${e.message}`);
|
||||
}
|
||||
};
|
||||
@@ -209,7 +209,8 @@ export default function Profile() {
|
||||
const handleBuy = async (planName: string) => {
|
||||
try {
|
||||
await buySubscription(planName);
|
||||
window.location.reload();
|
||||
const newData = await fetchProfile();
|
||||
setData(newData);
|
||||
} catch (e: any) {
|
||||
alert(`[ERROR] ${e.message}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user