Skip to content

Commit

Permalink
Merge pull request #188 from PnEcrins/revert_api_url_changes
Browse files Browse the repository at this point in the history
Revert API URL changes
  • Loading branch information
camillemonchicourt authored Nov 27, 2024
2 parents 8ab39db + 9473e21 commit e8ec85b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
CHANGELOG
=========

1.1.1+dev (unreleased)
----------------------

**Bugfix**

- Revert changes about NG_APP_API_URL. No need to change it in production environments.


1.1.1 (2024-11-26)
---------------------

Expand Down
19 changes: 13 additions & 6 deletions front-end/src/app/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ export class AuthService {
}

getAccount() {
return this.httpClient.get(`${this.apiUrl}accounts/me/`, httpOptions);
return this.httpClient.get(`${this.apiUrl}/api/accounts/me/`, httpOptions);
}

login(account: { email: string; password: string }) {
return this.httpClient.post(`${this.apiUrl}token/`, account, httpOptions);
return this.httpClient.post(
`${this.apiUrl}/api/token/`,
account,
httpOptions,
);
}

logout() {
Expand All @@ -49,19 +53,22 @@ export class AuthService {
password: string;
}) {
return this.httpClient.post(
`${this.apiUrl}accounts/sign-up/`,
`${this.apiUrl}/api/accounts/sign-up/`,
account,
httpOptions,
);
}

deleteAccount() {
return this.httpClient.delete(`${this.apiUrl}accounts/me/`, httpOptions);
return this.httpClient.delete(
`${this.apiUrl}/api/accounts/me/`,
httpOptions,
);
}

changePassword(password: string) {
return this.httpClient.patch(
`${this.apiUrl}accounts/me/`,
`${this.apiUrl}/api/accounts/me/`,
{ password },
httpOptions,
);
Expand All @@ -71,7 +78,7 @@ export class AuthService {

refreshToken(refreshRoken: string) {
return this.httpClient.post(
`${this.apiUrl}token/refresh/`,
`${this.apiUrl}/api/token/refresh/`,
{
refresh: refreshRoken,
},
Expand Down
16 changes: 8 additions & 8 deletions front-end/src/app/services/observations.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class ObservationsService {
startDate?: string,
endDate?: string,
) {
let url = `${this.apiUrl}observations/`;
let url = `${this.apiUrl}/api/observations/`;
if (observationTypesId) {
for (let index = 0; index < observationTypesId.length; index++) {
const observationTypeId = observationTypesId[index];
Expand All @@ -42,37 +42,37 @@ export class ObservationsService {

getObservation(observationId: string) {
return this.httpClient.get(
`${this.apiUrl}observations/${observationId}/`,
`${this.apiUrl}/api/observations/${observationId}/`,
httpOptions,
);
}

getMyObservations() {
return this.httpClient.get(
`${this.apiUrl}accounts/me/observations/`,
`${this.apiUrl}/api/accounts/me/observations/`,
httpOptions,
);
}

postObservation(observation: ObservationFeature) {
return this.httpClient.post(
`${this.apiUrl}accounts/me/observations/`,
`${this.apiUrl}/api/accounts/me/observations/`,
{ ...observation },
httpOptions,
);
}

putObservation(observationUuid: string, observation: ObservationFeature) {
return this.httpClient.put(
`${this.apiUrl}accounts/me/observations/${observationUuid}/`,
`${this.apiUrl}/api/accounts/me/observations/${observationUuid}/`,
{ ...observation },
httpOptions,
);
}

deleteObservation(observationUuid: string) {
return this.httpClient.delete(
`${this.apiUrl}accounts/me/observations/${observationUuid}/`,
`${this.apiUrl}/api/accounts/me/observations/${observationUuid}/`,
httpOptions,
);
}
Expand All @@ -82,14 +82,14 @@ export class ObservationsService {
formData.append('media_file', file);
formData.append('media_type', 'image');
return this.httpClient.post(
`${this.apiUrl}accounts/me/observations/${observationId}/medias/`,
`${this.apiUrl}/api/accounts/me/observations/${observationId}/medias/`,
formData,
);
}

deletePhotoObservation(observationUuid: string, photoId: string) {
return this.httpClient.delete(
`${this.apiUrl}accounts/me/observations/${observationUuid}/medias/${photoId}/`,
`${this.apiUrl}/api/accounts/me/observations/${observationUuid}/medias/${photoId}/`,
httpOptions,
);
}
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/app/services/settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class SettingsService {
}

getSettings() {
return this.httpClient.get(`${this.apiUrl}settings/`, httpOptions);
return this.httpClient.get(`${this.apiUrl}/api/settings/`, httpOptions);
}

async setSettings(settings: Settings) {
Expand Down

0 comments on commit e8ec85b

Please sign in to comment.