From 94976d25587410b0825912dd48d2946f19bb9472 Mon Sep 17 00:00:00 2001 From: Pieter Stols Date: Fri, 26 Apr 2024 19:41:36 +0300 Subject: [PATCH] corrected site url --- pages/add-client.jsx | 2 +- pages/edit/[id].jsx | 6 +++--- pages/index.jsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/add-client.jsx b/pages/add-client.jsx index f845b0b..0a6993d 100644 --- a/pages/add-client.jsx +++ b/pages/add-client.jsx @@ -24,7 +24,7 @@ const Add = () => { const handleSubmit = async () => { event.preventDefault() - const res = await fetch(`${process.env.MONGODB_URI}/api/add-client`, { + const res = await fetch(`${process.env.WEBURL}/api/add-client`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(newClient) diff --git a/pages/edit/[id].jsx b/pages/edit/[id].jsx index ddb7af4..e02aa37 100644 --- a/pages/edit/[id].jsx +++ b/pages/edit/[id].jsx @@ -23,7 +23,7 @@ const Edit = ({ data }) => { const handleSubmit = async e => { e.preventDefault() - const res = await fetch(`${process.env.MONGODB_URI}/api/update-client`, { + const res = await fetch(`${process.env.WEBURL}/api/update-client`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(client) @@ -39,7 +39,7 @@ const Edit = ({ data }) => { const handleDelete = async e => { e.preventDefault() - const res = await fetch(`${process.env.MONGODB_URI}/api/delete-client`, { + const res = await fetch(`${process.env.WEBURL}/api/delete-client`, { method: 'DELETE', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: client.id, name: client.name }) @@ -205,7 +205,7 @@ const Edit = ({ data }) => { Edit.getInitialProps = async function (context) { const { id } = context.query - const res = await fetch(`${process.env.MONGODB_URI}/api/get-client?id=${id}`) + const res = await fetch(`${process.env.WEBURL}/api/get-client?id=${id}`) const data = await res.json() return { data: data.user } diff --git a/pages/index.jsx b/pages/index.jsx index 3b767b1..76d2644 100644 --- a/pages/index.jsx +++ b/pages/index.jsx @@ -41,7 +41,7 @@ const Home = ({ clients }) => ( ) Home.getInitialProps = async function () { - const res = await fetch(`${process.env.MONGODB_URI}/api/clients`) + const res = await fetch(`${process.env.WEBURL}/api/clients`) const data = await res.json() return {