feat: add create user component (#544)

Fixes: #532
This commit is contained in:
punwai
2020-01-04 20:52:13 +03:00
committed by Abhay Chawla
parent 15ff035d13
commit 4ac086381f
9 changed files with 358 additions and 4 deletions
+26 -1
View File
@@ -1,6 +1,6 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpClient, HttpParams } from '@angular/common/http';
/** rxjs Imports */
import { Observable } from 'rxjs';
@@ -25,4 +25,29 @@ export class UsersService {
return this.http.get('/users');
}
/**
* @returns {Observable<any>} Users template data
*/
getUsersTemplate(): Observable<any> {
return this.http.get('/users/template');
}
/**
* @param {any} user User to be created.
* @returns {Observable<any>}
*/
createUser(user: any): Observable<any> {
return this.http.post('/users', user);
}
/**
* @param {any} officeId ID of office to retrieve staff from.
* @returns {Observable<any>} Staff data.
*/
getStaff(officeId: any): Observable<any> {
const httpParams = new HttpParams()
.set('officeId', officeId.toString());
return this.http.get('/staff', { params: httpParams });
}
}