phase 1-6 implemented
This commit is contained in:
1 parent
22c274bb83
commit
2c4927478a
73 files changed
+9702
-2354
No files matched your search
@@ -12,6 +12,7 @@ import {
|
||||
} from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useUser } from "@clerk/nextjs";
|
||||
import log from "@/lib/logger";
|
||||
|
||||
interface Backup {
|
||||
name: string;
|
||||
@@ -56,7 +57,7 @@ export default function SettingsPage() {
|
||||
const response = await axios.get("/api/admin/backups");
|
||||
setBackups(response.data);
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch backups:", error);
|
||||
log.error("Failed to fetch backups", error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -69,7 +70,7 @@ export default function SettingsPage() {
|
||||
const res = await axios.get("/api/gyms");
|
||||
setGyms(Array.isArray(res.data) ? res.data : []);
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch gyms:", error);
|
||||
log.error("Failed to fetch gyms", error);
|
||||
setGymMessage({ type: "error", text: "Failed to load gyms" });
|
||||
} finally {
|
||||
setGymsLoading(false);
|
||||
@@ -89,7 +90,7 @@ export default function SettingsPage() {
|
||||
await fetchBackups();
|
||||
setMessage({ type: "success", text: "Backup created successfully" });
|
||||
} catch (error) {
|
||||
console.error("Failed to create backup:", error);
|
||||
log.error("Failed to create backup", error);
|
||||
setMessage({ type: "error", text: "Failed to create backup" });
|
||||
} finally {
|
||||
setCreatingBackup(false);
|
||||
@@ -112,7 +113,7 @@ export default function SettingsPage() {
|
||||
setMessage({ type: "success", text: "Database restored successfully" });
|
||||
// Optional: Refresh page or force re-login if session is invalidated
|
||||
} catch (error) {
|
||||
console.error("Failed to restore backup:", error);
|
||||
log.error("Failed to restore backup", error);
|
||||
setMessage({ type: "error", text: "Failed to restore backup" });
|
||||
} finally {
|
||||
setRestoring(null);
|
||||
@@ -144,7 +145,7 @@ export default function SettingsPage() {
|
||||
text: gymId ? "Gym selected successfully" : "Proceeding without gym",
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Failed to set gym:", error);
|
||||
log.error("Failed to set gym", error);
|
||||
setGymMessage({ type: "error", text: "Failed to set gym" });
|
||||
}
|
||||
};
|
||||
@@ -247,7 +248,7 @@ export default function SettingsPage() {
|
||||
setGymLocation("");
|
||||
fetchGyms();
|
||||
} catch (error) {
|
||||
console.error("Failed to create gym:", error);
|
||||
log.error("Failed to create gym", error);
|
||||
setGymMessage({
|
||||
type: "error",
|
||||
text: "Failed to create gym",
|
||||
|
||||
Reference in new issue
Block a user