Added an API to add & delete entries from the skippedArtists list in the settings. fixes [#405]

This commit is contained in:
2024-05-20 14:24:47 +02:00
parent b481108af1
commit d47da91e93
8 changed files with 84 additions and 0 deletions

View File

@@ -159,3 +159,25 @@ export const hideSettingsWindow = function () {
export const closeSettingsWindow = function () {
settingsWindow = null;
};
/**
* add artists to the list of skipped artists
* @param artists list of artists to append
*/
export const addSkippedArtists = (artists: string[]) => {
const { skippedArtists } = settings;
const previousStoreValue = settingsStore.get<string, string[]>(skippedArtists);
settingsStore.set(skippedArtists, Array.from(new Set([...previousStoreValue, ...artists])));
};
/**
* Remove artists from the list of skipped artists
* @param artists list of artists to remove
*/
export const removeSkippedArtists = (artists: string[]) => {
const { skippedArtists } = settings;
const previousStoreValue = settingsStore.get<string, string[]>(skippedArtists);
const filteredArtists = previousStoreValue.filter((value) => !artists.includes(value));
settingsStore.set(skippedArtists, filteredArtists);
};