This commit is contained in:
tiago.kayaya
2021-08-03 12:24:34 +01:00
parent 2e2907a5b1
commit 5b8a9a24a1
6 changed files with 167 additions and 51 deletions
+19 -21
View File
@@ -14,7 +14,7 @@ export class AttachmentsService {
loggeduser: User;
headers: HttpHeaders;
constructor(private http: HttpClient, user: AuthService) {
constructor(private http: HttpClient, user: AuthService) {
this.loggeduser = user.ValidatedUser;
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
@@ -26,9 +26,9 @@ export class AttachmentsService {
params = params.set("SerialNumber", serialNumber);
let options = {
headers: this.headers,
params: params
let options = {
headers: this.headers,
params: params
};
return this.http.get<Attachment[]>(`${geturl}`, options);
}
@@ -39,10 +39,10 @@ export class AttachmentsService {
params = params.set("Source", source.toString());
/* params = params.set("SourceId", sourceid); */
let options = {
headers: this.headers,
params: params
let options = {
headers: this.headers,
params: params
};
return this.http.get<Attachment[]>(`${geturl}`, options);
@@ -54,37 +54,35 @@ export class AttachmentsService {
params = params.set("ParentId", eventId);
/* params = params.set("SourceId", sourceid); */
let options = {
headers: this.headers,
params: params
headers: this.headers,
params: params
};
return this.http.get<Attachment[]>(`${geturl}`, options);
}
setEventAttachmentById(body: EventAttachment) {
setEventAttachmentById(body: any) {
let geturl = environment.apiURL + 'Attachments/Create';
let options = {
headers: this.headers,
let options = {
headers: this.headers,
}
return this.http.post(`${geturl}`, body, options);
}
deleteEventAttachmentById(attachmentId) {
deleteEventAttachmentById(attachmentId) {
let geturl = environment.apiURL + `Attachments/Delete?attachmentId=${attachmentId}`;
let params = new HttpParams();
params = params.set("attachmentId", attachmentId);
let options = {
headers: this.headers,
params: params
let options = {
headers: this.headers,
params: params
}
return this.http.delete(`${geturl}`, options);