remove get languages from dictionary repo

This commit is contained in:
Mads Rasmussen
2024-02-01 14:48:56 +01:00
parent 60aa62d3de
commit 7f49a49352

View File

@@ -31,26 +31,4 @@ export class UmbDictionaryRepository extends UmbBaseController implements UmbApi
return this.#temporaryFileRepository.upload(UmbId, file);
}
// TODO => temporary only, until languages data source exists, or might be
// ok to keep, as it reduces downstream dependencies
async getLanguages() {
await this.#init;
const { data } = await this.#detailSource.getLanguages();
// default first, then sorted by name
// easier to unshift than conditionally sorting by bool and string
const languages =
data?.items.sort((a, b) => {
a.name = a.name ?? '';
b.name = b.name ?? '';
return a.name > b.name ? 1 : b.name > a.name ? -1 : 0;
}) ?? [];
const defaultIndex = languages.findIndex((x) => x.isDefault);
languages.unshift(...languages.splice(defaultIndex, 1));
return languages;
}
}