mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-02 09:48:22 +00:00
refactor: enhance error handling and add pagination to device queries
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m37s
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m37s
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
import { getPayment } from "@/actions/payment";
|
||||
import { authOptions } from "@/app/auth";
|
||||
import CancelPaymentButton from "@/components/billing/cancel-payment-button";
|
||||
import ClientErrorMessage from "@/components/client-error-message";
|
||||
import DevicesToPay from "@/components/devices-to-pay";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { tryCatch } from "@/utils/tryCatch";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { redirect } from "next/navigation";
|
||||
export default async function PaymentPage({
|
||||
params,
|
||||
}: {
|
||||
@ -15,7 +17,8 @@ export default async function PaymentPage({
|
||||
const paymentId = (await params).paymentId;
|
||||
const [error, payment] = await tryCatch(getPayment({ id: paymentId }));
|
||||
if (error) {
|
||||
return <span>Error getting payment: {error.message}</span>;
|
||||
if (error.message === "Invalid token.") redirect("/auth/signin");
|
||||
return <ClientErrorMessage message={error.message} />;
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
|
Reference in New Issue
Block a user