internal fixes
This commit is contained in:
@@ -244,4 +244,5 @@ export interface Lead {
|
||||
moving_price: string
|
||||
moving_date: string
|
||||
comment: string
|
||||
route?: number
|
||||
}
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
import { Lead } from '@/app/types'
|
||||
import { getSession } from 'next-auth/react'
|
||||
|
||||
export const sendLead = async (data: Lead) => {
|
||||
export const sendLead = async (data: Lead & { id?: number }) => {
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL
|
||||
const session = await getSession()
|
||||
|
||||
if (!session?.accessToken) {
|
||||
throw new Error('No access token found')
|
||||
}
|
||||
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${session.accessToken}`,
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -16,6 +23,7 @@ export const sendLead = async (data: Lead) => {
|
||||
moving_price: data.moving_price,
|
||||
moving_date: data.moving_date,
|
||||
comment: data.comment,
|
||||
route: data.id,
|
||||
})
|
||||
|
||||
const response = await fetch(`${API_URL}/account/send_lead/`, {
|
||||
|
||||
Reference in New Issue
Block a user