diff --git a/frontend/src/app/history/page.tsx b/frontend/src/app/history/page.tsx index fa213ad..0c26d91 100644 --- a/frontend/src/app/history/page.tsx +++ b/frontend/src/app/history/page.tsx @@ -105,14 +105,20 @@ export default function HistoryPage() { PAGE_SIZE, serverSort, ); + if (!data || !data.payments) { + throw new Error("Invalid response: missing payments data"); + } setRecords(data.payments); setPagination({ - page: data.pagination.page, - pages: data.pagination.pages, - total: data.pagination.total, + page: data.pagination?.page ?? 1, + pages: data.pagination?.pages ?? 1, + total: data.pagination?.total ?? 0, }); } catch (e: any) { - setError(e.message ?? "Failed to load payment history"); + const errorMsg = e.message ?? "Failed to load payment history"; + setError(errorMsg); + setRecords([]); + setPagination({ page: 1, pages: 1, total: 0 }); } finally { setLoading(false); } diff --git a/frontend/src/components/CollaboratorTable.tsx b/frontend/src/components/CollaboratorTable.tsx index 7d3477f..c13f080 100644 --- a/frontend/src/components/CollaboratorTable.tsx +++ b/frontend/src/components/CollaboratorTable.tsx @@ -14,6 +14,7 @@ interface Props { loading?: boolean; onAdd: (address: string, basisPoints: number) => Promise; onRemove: (address: string) => Promise; + onRefresh?: () => Promise; } import styles from './CollaboratorTable.module.css'; diff --git a/frontend/src/store/paymentStore.ts b/frontend/src/store/paymentStore.ts index 371673a..48ec398 100644 --- a/frontend/src/store/paymentStore.ts +++ b/frontend/src/store/paymentStore.ts @@ -1,7 +1,6 @@ "use client"; import { create } from "zustand"; -import { persist } from "zustand/middleware"; interface PaymentFormState { meterId: string; @@ -11,17 +10,10 @@ interface PaymentFormState { reset: () => void; } -export const usePaymentStore = create()( - persist( - (set) => ({ - meterId: "", - plan: "Daily", - setMeterId: (id: string) => set({ meterId: id }), - setPlan: (plan: "Daily" | "Weekly" | "Usage") => set({ plan }), - reset: () => set({ meterId: "", plan: "Daily" }), - }), - { - name: "payment-form", - } - ) -); +export const usePaymentStore = create((set) => ({ + meterId: "", + plan: "Daily", + setMeterId: (id: string) => set({ meterId: id }), + setPlan: (plan: "Daily" | "Weekly" | "Usage") => set({ plan }), + reset: () => set({ meterId: "", plan: "Daily" }), +})); diff --git a/frontend/src/store/walletStore.ts b/frontend/src/store/walletStore.ts index 1169a34..edac77a 100644 --- a/frontend/src/store/walletStore.ts +++ b/frontend/src/store/walletStore.ts @@ -37,6 +37,9 @@ export const useWalletStore = create((set, get) => ({ connect: async () => { set({ connectError: null }); try { + if (typeof window === "undefined" || !(window as any).freighter) { + throw new Error("Freighter extension is not installed. Please install it to continue."); + } const kit = buildKit(); await kit.openModal({ onWalletSelected: async (option) => {