Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert API URL changes #188

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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