mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-08-04 09:37:42 +00:00
feat(admin-topup): add description field to topup form and validation for amount
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 8m56s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 8m56s
fix(verify-registration-otp): improve styling and structure of OTP verification form
This commit is contained in:
@ -11,14 +11,14 @@ import { handleApiResponse } from "@/utils/tryCatch";
|
||||
|
||||
type VerifyUserResponse =
|
||||
| {
|
||||
ok: boolean;
|
||||
mismatch_fields: string[] | null;
|
||||
error: string | null;
|
||||
detail: string | null;
|
||||
}
|
||||
ok: boolean;
|
||||
mismatch_fields: string[] | null;
|
||||
error: string | null;
|
||||
detail: string | null;
|
||||
}
|
||||
| {
|
||||
message: boolean;
|
||||
};
|
||||
message: boolean;
|
||||
};
|
||||
export async function verifyUser(userId: string) {
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session?.apiToken) {
|
||||
@ -230,6 +230,7 @@ export type AddTopupFormState = {
|
||||
message: string;
|
||||
fieldErrors?: {
|
||||
amount?: string[];
|
||||
description?: string[];
|
||||
};
|
||||
payload?: FormData;
|
||||
};
|
||||
@ -242,6 +243,15 @@ export async function adminUserTopup(
|
||||
const amount = formData.get("amount") as string;
|
||||
const session = await getServerSession(authOptions);
|
||||
|
||||
|
||||
if (!amount) {
|
||||
return {
|
||||
status: false,
|
||||
message: "Amount is required",
|
||||
fieldErrors: { amount: ["Amount is required"], description: [] },
|
||||
payload: formData,
|
||||
}
|
||||
}
|
||||
const response = await fetch(
|
||||
`${process.env.SARLINK_API_BASE_URL}/api/billing/admin-topup/`,
|
||||
{
|
||||
|
Reference in New Issue
Block a user