Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. setAlert(params: SetAlertParams) {
  2. return this.http.get<{user: string, password: string}>(urls.getCredentials).pipe(
  3. switchMap(credentials => {
  4. const headers = new HttpHeaders({
  5. 'Content-Type': 'application/json',
  6. 'Authentication': `Basic ${btoa(`${credentials.user}${credentials.password}`)}`
  7. });
  8. const formData = new FormData();
  9. Object.keys(params).forEach(key => formData.append(key, params[key]));
  10. return this.http.post<SetAlertResult>(urls.setAlert, formData, {
  11. headers: headers,
  12. withCredentials: true
  13. });
  14. }
  15. ));
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement