Skip to content

Commit

Permalink
fix(urls): redo url for staging
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihoub2 committed May 29, 2024
1 parent 06e08b7 commit 6e9f379
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
22 changes: 10 additions & 12 deletions src/api/send-mail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ function EmailSender({
<p>${userResponse}</p>
`,
};
console.log(contribution);
// const responseBrevo = await fetch("/email/", {
const responseBrevo = await fetch("https://api.brevo.com/v3/smtp/email", {
const responseBrevo = await fetch("/email/", {
// const responseBrevo = await fetch("https://api.brevo.com/v3/smtp/email", {
method: "POST",
headers: {
"api-key": import.meta.env.VITE_BREVO_API_AUTHORIZATION,
Expand All @@ -71,15 +70,14 @@ function EmailSender({
responseFrom: selectedProfile,
};

// const responseScanR = await fetch(`/api/${basePath}/${contribution._id}`, {
const responseScanR = await fetch(
`https://scanr-api.dataesr.ovh/${basePath}/${contribution._id}`,
{
method: "PATCH",
headers: postHeaders,
body: JSON.stringify(dataForScanR),
}
);
const responseScanR = await fetch(`/api/${basePath}/${contribution._id}`, {
// const responseScanR = await fetch(
// `https://scanr-api.dataesr.ovh/${basePath}/${contribution._id}`,
// {
method: "PATCH",
headers: postHeaders,
body: JSON.stringify(dataForScanR),
});

if (!responseScanR.ok) {
throw new Error(`HTTP error! status: ${responseScanR.status}`);
Expand Down
4 changes: 2 additions & 2 deletions src/api/utils/buildURL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ export const buildURL = (
const whereQuery =
Object.keys(where).length > 0 ? `&where=${JSON.stringify(where)}` : "";

// return `/api/${baseUrl}?${sorted}&page=${page}&max_results=20${whereQuery}`;
return `https://scanr-api.dataesr.ovh/${baseUrl}?${sorted}&page=${page}&max_results=20${whereQuery}`;
return `/api/${baseUrl}?${sorted}&page=${page}&max_results=20${whereQuery}`;
// return `https://scanr-api.dataesr.ovh/${baseUrl}?${sorted}&page=${page}&max_results=20${whereQuery}`;
};
4 changes: 2 additions & 2 deletions src/components/edit-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ const EditModal: React.FC<EditModalProps> = ({
const handleSubmit = async () => {
try {
const response = await fetch(
`https://scanr-api.dataesr.ovh/${basePath}/${data._id}`,
// `${window.location.origin}/api/${basePath}/${data._id}`,
// `https://scanr-api.dataesr.ovh/${basePath}/${data._id}`,
`${window.location.origin}/api/${basePath}/${data._id}`,
{
method: "PATCH",
headers: postHeaders,
Expand Down

0 comments on commit 6e9f379

Please sign in to comment.