Add console /registrars GET endpoint (#2050)

This commit is contained in:
Pavlo Tkach 2023-06-09 16:57:26 -04:00 committed by GitHub
parent 2415097105
commit 270fe06c34
8 changed files with 204 additions and 10 deletions

View file

@ -49,13 +49,11 @@ export class ContactService {
contacts: Contact[],
registrarId?: string
): Observable<Contact[]> {
return this.backend
.postContacts(registrarId || 'default', contacts)
.pipe(
tap((_) => {
this.contacts = contacts;
})
);
return this.backend.postContacts(registrarId || 'default', contacts).pipe(
tap((_) => {
this.contacts = contacts;
})
);
}
updateContact(index: number, contact: Contact) {

View file

@ -62,11 +62,20 @@ export class BackendService {
},
];
return this.http
.get<Contact[]>(`/console-api/settings/contacts?registrarId=${registrarId}`)
.pipe(catchError((err) => this.errorCatcher<Contact[]>(err, <Contact[]>mockData)));
.get<Contact[]>(
`/console-api/settings/contacts?registrarId=${registrarId}`
)
.pipe(
catchError((err) =>
this.errorCatcher<Contact[]>(err, <Contact[]>mockData)
)
);
}
postContacts(registrarId: string, contacts: Contact[]): Observable<Contact[]> {
postContacts(
registrarId: string,
contacts: Contact[]
): Observable<Contact[]> {
return this.http.post<Contact[]>(
`/console-api/settings/contacts?registrarId=${registrarId}`,
{ contacts }