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) => {
|
export const newsRegisterRequest = async (payload: TRegisterSchema) => {
|
||||||
try {
|
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)
|
return loginResponseSchema.parse(data)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line unicorn/no-useless-promise-resolve-reject
|
// eslint-disable-next-line unicorn/no-useless-promise-resolve-reject
|
||||||
|
|||||||
@ -53,12 +53,12 @@ export const Select = <TFormValues extends Record<string, unknown>>(
|
|||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
<option value="">{placeholder}</option>
|
<option value="">{placeholder}</option>
|
||||||
{options?.map((option) => (
|
{options?.map(({ id, name }) => (
|
||||||
<option
|
<option
|
||||||
key={option.id}
|
key={id}
|
||||||
value={option.code}
|
value={id}
|
||||||
>
|
>
|
||||||
{option.name}
|
{name}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</HeadlessSelect>
|
</HeadlessSelect>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user