RED-6910, fix adding causing deleting of current items.

This commit is contained in:
George 2023-06-14 19:13:56 +03:00
parent 984708bac3
commit 532ee9fa06
2 changed files with 1 additions and 5 deletions

View File

@ -58,7 +58,6 @@ export class DictionaryScreenComponent implements OnInit {
null,
true,
DICTIONARY_TO_ENTRY_TYPE_MAP[this.type],
false,
);
await this.#loadEntries();
} catch (e) {

View File

@ -94,7 +94,6 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
dossierId: string,
showToast = true,
dictionaryEntryType = DictionaryEntryTypes.ENTRY,
removeCurrent = true,
) {
const entriesToAdd: Array<string> = [];
const initialEntriesSet = new Set(initialEntries);
@ -127,7 +126,7 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
await this._deleteEntries(deletedEntries, dossierTemplateId, type, dictionaryEntryType, dossierId);
}
if (entriesToAdd.length) {
await this._addEntries(entriesToAdd, dossierTemplateId, type, dictionaryEntryType, dossierId, removeCurrent);
await this._addEntries(entriesToAdd, dossierTemplateId, type, dictionaryEntryType, dossierId);
}
if (showToast) {
@ -235,12 +234,10 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
type: string,
dictionaryEntryType: DictionaryEntryType,
dossierId: string,
removeCurrent = true,
) {
const queryParams: List<QueryParam> = [
{ key: 'dossierId', value: dossierId },
{ key: 'dictionaryEntryType', value: dictionaryEntryType },
{ key: 'removeCurrent', value: removeCurrent },
];
const url = `${this._defaultModelPath}/${type}/${dossierTemplateId}`;
return firstValueFrom(this._post(entries, url, queryParams));