Skip to content

Commit

Permalink
fix(deploiement): update nginx conf location
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihoub2 committed May 16, 2024
1 parent 81d95c9 commit df9480b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
1 change: 1 addition & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ server {
try_files $uri $uri/ /index.html =404;
}
location ~ ^/api/(.*)$ {
proxy_pass https://scanr-api.dataesr.ovh/$1;
proxy_set_header Authorization 'Basic $VITE_SCANR_API_AUTHORIZATION';
proxy_set_header Accept application/json;
proxy_set_header Content-Type application/json;
Expand Down
13 changes: 5 additions & 8 deletions src/api/send-mail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,11 @@ function EmailSender({ contribution }: { contribution: Contribution }) {
const data = {
comment: response,
};
const responsePatch = await fetch(
`https://scanr-api.dataesr.ovh/${basePath}/${contribution._id}`,
{
method: "PATCH",
headers: postHeaders,
body: JSON.stringify(data),
}
);
const responsePatch = await fetch(`api/${basePath}/${contribution._id}`, {
method: "PATCH",
headers: postHeaders,
body: JSON.stringify(data),
});
if (!responsePatch.ok) {
console.log("Erreur lors de la mise à jour de la contribution");
return;
Expand Down
2 changes: 1 addition & 1 deletion src/api/utils/buildURL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export const buildURL = (
const whereQuery =
Object.keys(where).length > 0 ? `&where=${JSON.stringify(where)}` : "";

return `https://scanr-api.dataesr.ovh/${baseUrl}?${sorted}&page=${page}&max_results=20${whereQuery}`;
return `api/${baseUrl}?${sorted}&page=${page}&max_results=20${whereQuery}`;
};
21 changes: 9 additions & 12 deletions src/components/edit-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,15 @@ const EditModal: React.FC<EditModalProps> = ({ isOpen, data, onClose }) => {

const handleSubmit = async () => {
try {
const response = await fetch(
`https://scanr-api.dataesr.ovh/${basePath}/${data._id}`,
{
method: "PATCH",
headers: postHeaders,
body: JSON.stringify({
status: inputs.status,
tag: inputs.tag,
idref: inputs.idRef,
}),
}
);
const response = await fetch(`api/${basePath}/${data._id}`, {
method: "PATCH",
headers: postHeaders,
body: JSON.stringify({
status: inputs.status,
tag: inputs.tag,
idref: inputs.idRef,
}),
});
if (!response.ok) {
console.log("Erreur de réponse", response);
} else {
Expand Down

0 comments on commit df9480b

Please sign in to comment.