mirror of
https://github.com/google/nomulus
synced 2026-01-05 04:56:03 +00:00
Refactor the way that the console BE parses POST bodies (#2113)
This includes two changes: 1. Creating a base string-type adapter for use parsing to/from JSON classes that are represented as simple strings 2. Changing the object-provider methods so that the POST bodies should contain precisely the expected object(s) and nothing else. This way, it's easier for the frontend and backend to agree that, for instance, one POST endpoint might accept exactly a Registrar object, or a list of Contact objects.
This commit is contained in:
@@ -12,12 +12,13 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
||||
import { Observable, catchError, of } from 'rxjs';
|
||||
import { Contact } from '../../settings/contact/contact.service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { catchError, Observable, of } from 'rxjs';
|
||||
import { SecuritySettingsBackendModel } from 'src/app/settings/security/security.service';
|
||||
|
||||
import { Contact } from '../../settings/contact/contact.service';
|
||||
|
||||
@Injectable()
|
||||
export class BackendService {
|
||||
constructor(private http: HttpClient) {}
|
||||
@@ -55,7 +56,7 @@ export class BackendService {
|
||||
): Observable<Contact[]> {
|
||||
return this.http.post<Contact[]>(
|
||||
`/console-api/settings/contacts?registrarId=${registrarId}`,
|
||||
{ contacts }
|
||||
contacts
|
||||
);
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ export class BackendService {
|
||||
): Observable<SecuritySettingsBackendModel> {
|
||||
return this.http.post<SecuritySettingsBackendModel>(
|
||||
`/console-api/settings/security?registrarId=${registrarId}`,
|
||||
{ registrar: securitySettings }
|
||||
securitySettings
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user