feat: transform registration payload to include subscription plan ID and update select options
This commit is contained in:
parent
adba58780a
commit
02e2ed3f52
@ -11,7 +11,15 @@ const loginResponseSchema = z.object({
|
||||
|
||||
export const newsRegisterRequest = async (payload: TRegisterSchema) => {
|
||||
try {
|
||||
const { data } = await HttpServer().post('/api/user/register', payload)
|
||||
const { subscription, ...restPayload } = payload
|
||||
const transformedPayload = {
|
||||
...restPayload,
|
||||
subscribe_plan_id: subscription,
|
||||
}
|
||||
const { data } = await HttpServer().post(
|
||||
'/api/user/register',
|
||||
transformedPayload,
|
||||
)
|
||||
return loginResponseSchema.parse(data)
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line unicorn/no-useless-promise-resolve-reject
|
||||
|
||||
@ -53,12 +53,12 @@ export const Select = <TFormValues extends Record<string, unknown>>(
|
||||
{...rest}
|
||||
>
|
||||
<option value="">{placeholder}</option>
|
||||
{options?.map((option) => (
|
||||
{options?.map(({ id, name }) => (
|
||||
<option
|
||||
key={option.id}
|
||||
value={option.code}
|
||||
key={id}
|
||||
value={id}
|
||||
>
|
||||
{option.name}
|
||||
{name}
|
||||
</option>
|
||||
))}
|
||||
</HeadlessSelect>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user