fix: new backend url

This commit is contained in:
Ruidy 2021-07-14 16:50:41 +02:00
parent d14a380276
commit 1f326cb12d
3 changed files with 3 additions and 4 deletions

View file

@ -1,13 +1,13 @@
import axios from "axios"; import axios from "axios";
import { Bill, BillForm } from "../types/bill"; import { Bill, BillForm } from "../types/bill";
const BASE_URL = "http://localhost:8000/api/v1/"; const BASE_URL = "http://localhost:9000/bills";
const client = axios.create({ baseURL: BASE_URL }); const client = axios.create({ baseURL: BASE_URL });
export const createBill = async (data: BillForm) => { export const createBill = async (data: BillForm) => {
try { try {
const { data: response } = await client.post("/", JSON.stringify(data)); const { data: response } = await client.post("/", data)
return response; return response;
} catch (error) { } catch (error) {
console.error(error); console.error(error);

View file

@ -35,7 +35,7 @@ const BillPage = ({ bill }: BillProps) => {
return ( return (
<main> <main>
<Typography.Title>Facture #VFNI{`${bill.number}`}</Typography.Title> <Typography.Title>Facture #VFNI{`${bill.id}`.padStart(4,"0")}</Typography.Title>
<Space> <Space>
<Button type="primary" onClick={() => handleSendPDF(bill.id)} disabled={sent}> <Button type="primary" onClick={() => handleSendPDF(bill.id)} disabled={sent}>
{sent ? "The bill is on its way to your customer" : "Send Bill"} {sent ? "The bill is on its way to your customer" : "Send Bill"}

View file

@ -15,7 +15,6 @@ export type BillForm = {
export interface Bill { export interface Bill {
id: number; id: number;
phoneNumber: number; phoneNumber: number;
number: number;
name: string; name: string;
price: number; price: number;
start: Date; start: Date;