Fix about the favorite DZ
This commit is contained in:
@@ -72,9 +72,9 @@ export class AuthenticationService extends BaseService {
|
||||
}
|
||||
|
||||
private alwaysLogin() {
|
||||
return this.http.get(`${this.apiUrl}/User/AlwayLogin`, {
|
||||
return this.http.get(`${this.apiUrl}/User/AlwaysLogin`, {
|
||||
headers: this.headers
|
||||
});
|
||||
}).subscribe();
|
||||
}
|
||||
|
||||
logout() {
|
||||
|
||||
@@ -14,50 +14,42 @@ export class DropzoneService extends BaseService {
|
||||
}
|
||||
|
||||
public getListOfDropZones(): Observable<Array<DropZoneResp>> {
|
||||
return this.http
|
||||
.get<Array<DropZoneResp>>(`${this.apiUrl}/DropZone`, {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(
|
||||
map(response => {
|
||||
const details = response.map(data => new DropZoneResp(data));
|
||||
return details;
|
||||
})
|
||||
);
|
||||
return this.http.get<Array<DropZoneResp>>(`${this.apiUrl}/DropZone`,
|
||||
{ headers: this.headers })
|
||||
.pipe(map(response => {
|
||||
const details = response.map(data => new DropZoneResp(data));
|
||||
return details;
|
||||
}));
|
||||
}
|
||||
|
||||
public SetFavoriteDropZone(selectedDz: DropZoneResp): boolean {
|
||||
selectedDz.isFavorite = true;
|
||||
this.http
|
||||
.put(`${this.apiUrl}/DropZone/${selectedDz.id}`, selectedDz, {
|
||||
headers: this.headers
|
||||
})
|
||||
.subscribe(data => console.log(data));
|
||||
this.http.put(`${this.apiUrl}/DropZone/AddToFavorite/${selectedDz.id}`,
|
||||
selectedDz,
|
||||
{ headers: this.headers })
|
||||
.subscribe(data => console.log(data));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public RemoveFavoriteDropZone(selectedDz: DropZoneResp): boolean {
|
||||
selectedDz.isFavorite = false;
|
||||
this.http
|
||||
.put(`${this.apiUrl}/DropZone/${selectedDz.id}`, selectedDz, {
|
||||
headers: this.headers
|
||||
})
|
||||
.subscribe(data => console.log(data));
|
||||
this.http.put(`${this.apiUrl}/DropZone/RemoveToFavorite${selectedDz.id}`,
|
||||
selectedDz,
|
||||
{ headers: this.headers })
|
||||
.subscribe(data => console.log(data));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public AddDropZone(
|
||||
latitude: string,
|
||||
longitude: string,
|
||||
name: string,
|
||||
address: string,
|
||||
website: string,
|
||||
email: string,
|
||||
type: Array<string>,
|
||||
isFavorite: boolean
|
||||
) {
|
||||
public AddDropZone(latitude: string,
|
||||
longitude: string,
|
||||
name: string,
|
||||
address: string,
|
||||
website: string,
|
||||
email: string,
|
||||
type: Array<string>,
|
||||
isFavorite: boolean) {
|
||||
const bodyNewDropZone: DropZoneReq = {
|
||||
id: 0,
|
||||
latitude: latitude,
|
||||
@@ -70,10 +62,9 @@ export class DropzoneService extends BaseService {
|
||||
isFavorite: isFavorite
|
||||
};
|
||||
|
||||
this.http
|
||||
.post(`${this.apiUrl}/DropZone`, bodyNewDropZone, {
|
||||
headers: this.headers
|
||||
})
|
||||
.subscribe(data => console.log(data));
|
||||
this.http.post(`${this.apiUrl}/DropZone`,
|
||||
bodyNewDropZone,
|
||||
{ headers: this.headers })
|
||||
.subscribe(data => console.log(data));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user