owner type fix + route handler refactor
This commit is contained in:
@@ -5,7 +5,7 @@ const DelivelerPage = () => {
|
|||||||
return (
|
return (
|
||||||
<RouteForm
|
<RouteForm
|
||||||
routeHandlerUrl="/api/account/create-route"
|
routeHandlerUrl="/api/account/create-route"
|
||||||
ownerType="customer"
|
ownerType="mover"
|
||||||
title="Перевезти посылку"
|
title="Перевезти посылку"
|
||||||
description="Заполните информацию о вашем маршруте и посылке, которую Вы сможете перевезти"
|
description="Заполните информацию о вашем маршруте и посылке, которую Вы сможете перевезти"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const SenderPage = () => {
|
|||||||
return (
|
return (
|
||||||
<RouteForm
|
<RouteForm
|
||||||
routeHandlerUrl="/api/account/create-route"
|
routeHandlerUrl="/api/account/create-route"
|
||||||
ownerType="mover"
|
ownerType="customer"
|
||||||
title="Отправить посылку"
|
title="Отправить посылку"
|
||||||
description="Заполните информацию о вашей посылке и маршруте"
|
description="Заполните информацию о вашей посылке и маршруте"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
const page = () => {
|
const PaymentsPage = () => {
|
||||||
return <div>page</div>
|
return <div>page</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
export default page
|
export default PaymentsPage
|
||||||
|
|||||||
@@ -13,19 +13,6 @@ export async function POST(req: NextRequest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const data = await req.json()
|
const data = await req.json()
|
||||||
const {
|
|
||||||
transport,
|
|
||||||
country_from,
|
|
||||||
city_from,
|
|
||||||
country_to,
|
|
||||||
city_to,
|
|
||||||
cargo_type,
|
|
||||||
departure,
|
|
||||||
arrival,
|
|
||||||
phone_number,
|
|
||||||
comment,
|
|
||||||
email_notification,
|
|
||||||
} = data
|
|
||||||
|
|
||||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/account/create_route/`, {
|
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/account/create_route/`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -34,18 +21,8 @@ export async function POST(req: NextRequest) {
|
|||||||
Authorization: `Bearer ${session.accessToken}`,
|
Authorization: `Bearer ${session.accessToken}`,
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
owner_type: data.owner_type,
|
...data,
|
||||||
transport: data.transport,
|
|
||||||
country_from: data.country_from,
|
|
||||||
city_from: data.city_from,
|
|
||||||
country_to: data.country_to,
|
|
||||||
city_to: data.city_to,
|
|
||||||
cargo_type: data.cargo_type,
|
|
||||||
departure: data.departure,
|
|
||||||
arrival: data.arrival,
|
|
||||||
phone_number: data.phone_number,
|
|
||||||
comment: data.comment || '',
|
comment: data.comment || '',
|
||||||
email_notification: data.email_notification,
|
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user