remove duplicate store methods

This commit is contained in:
Mads Rasmussen
2023-11-14 22:13:17 +01:00
parent 5cfb1ce3ad
commit 403c73e625
2 changed files with 4 additions and 22 deletions

View File

@@ -153,7 +153,7 @@ export class UmbDocumentTypeDetailRepository
// Consider to look up the data before fetching from the server.
// Consider notify a workspace if a template is deleted from the store while someone is editing it.
// TODO: would be nice to align the stores on methods/methodNames.
this.#detailStore?.remove([id]);
this.#detailStore?.removeItem(id);
this.#treeStore?.removeItem(id);
this.#itemStore?.removeItem(id);
}

View File

@@ -25,31 +25,13 @@ export class UmbDocumentTypeDetailStore extends UmbStoreBase<DocumentTypeRespons
}
/**
* Append a document-type to the store
* @param {DocumentTypeModel} document
* @memberof UmbDocumentTypeStore
*/
append(document: DocumentTypeResponseModel) {
this._data.append([document]);
}
/**
* Append a document-type to the store
* @param {DocumentTypeModel} document
* @memberof UmbDocumentTypeStore
* @param {DocumentTypeResponseModel['id']} id
* @return {*}
* @memberof UmbDocumentTypeDetailStore
*/
byId(id: DocumentTypeResponseModel['id']) {
return this._data.asObservablePart((x) => x.find((y) => y.id === id));
}
/**
* Removes document-types in the store with the given uniques
* @param {string[]} uniques
* @memberof UmbDocumentTypeStore
*/
remove(uniques: Array<DocumentTypeResponseModel['id']>) {
this._data.remove(uniques);
}
}
export const UMB_DOCUMENT_TYPE_DETAIL_STORE_CONTEXT = new UmbContextToken<UmbDocumentTypeDetailStore>(