From 82f831ec606050368e29fa7fdb68fca1857f9f0d Mon Sep 17 00:00:00 2001 From: Bertrand Zuchuat Date: Tue, 3 Aug 2021 09:12:53 +0200 Subject: [PATCH] local fields: improve query result * Closes rero/rero-ils#2257. Co-Authored-by: Bertrand Zuchuat --- projects/admin/src/app/api/local-field-api.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/admin/src/app/api/local-field-api.service.ts b/projects/admin/src/app/api/local-field-api.service.ts index 97c86f418..8feeddb49 100644 --- a/projects/admin/src/app/api/local-field-api.service.ts +++ b/projects/admin/src/app/api/local-field-api.service.ts @@ -53,9 +53,9 @@ export class LocalFieldApiService { return this._recordService.getRecords('local_fields', query, 1, 1).pipe( map((result: any) => { - return this._recordService.totalHits(result.hits.total) === 1 - ? result.hits.hits[0] - : {}; + return this._recordService.totalHits(result.hits.total) === 0 + ? {} + : result.hits.hits[0]; }) ); }