mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-02-22 22:22:01 +00:00
- Updated `next.config.ts` to include remote image patterns for user verification. - Introduced `VerifyUserDetails` function in `lib/person.ts` to validate user data against national records. - Added `usePerson` hook for fetching national data based on ID card. - Enhanced `signup` and `signin` functions in `auth-actions.ts` to handle user verification status and send notifications for pending verifications. - Refactored `VerifyUser` function in `user-actions.ts` to incorporate national data validation. - Improved UI components in the user verification page to display both database and national information. - Updated `InputReadOnly` component to support customizable label classes for better styling. These changes improve the user verification process, ensuring data integrity and enhancing the overall user experience.
69 lines
1.4 KiB
TypeScript
69 lines
1.4 KiB
TypeScript
"use server";
|
|
|
|
type CreateClientProps = {
|
|
group_settings_id: string;
|
|
address1: string;
|
|
city: string;
|
|
state: string;
|
|
postal_code: string;
|
|
country_id: string;
|
|
address2: string;
|
|
contacts: Contact;
|
|
};
|
|
|
|
type Contact = {
|
|
first_name: string;
|
|
last_name: string;
|
|
email: string;
|
|
phone: string;
|
|
send_email: boolean;
|
|
custom_value1: string;
|
|
custom_value2: string;
|
|
custom_value3: string;
|
|
};
|
|
export async function CreateClient({
|
|
group_settings_id = "",
|
|
address1 = "",
|
|
city,
|
|
state,
|
|
postal_code = "",
|
|
country_id = "462",
|
|
address2,
|
|
contacts,
|
|
}: CreateClientProps) {
|
|
const response = await fetch(
|
|
"https://finance-staging.baraveli.dev/api/v1/clients",
|
|
{
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"x-api-token": `${process.env.NINJA_API_KEY}`,
|
|
},
|
|
body: JSON.stringify({
|
|
group_settings_id,
|
|
address1,
|
|
city,
|
|
state,
|
|
postal_code,
|
|
country_id,
|
|
address2,
|
|
contacts: [
|
|
{
|
|
first_name: contacts.first_name,
|
|
last_name: contacts.last_name,
|
|
email: contacts.email || "",
|
|
phone: contacts.phone,
|
|
send_email: contacts.send_email,
|
|
custom_value1: contacts.custom_value1,
|
|
custom_value2: contacts.custom_value2,
|
|
custom_value3: contacts.custom_value3 || "",
|
|
},
|
|
],
|
|
}),
|
|
},
|
|
);
|
|
const data = await response.json();
|
|
console.log(data.data.contacts);
|
|
return data;
|
|
}
|