diff --git a/src/lang/en.mjs b/src/lang/en.mjs index 601f1aa..166414f 100644 --- a/src/lang/en.mjs +++ b/src/lang/en.mjs @@ -222,7 +222,8 @@ const en = { noLovedPlaylist: 'No loved tracks playlist!', checkingUpdates: 'Checking for updates...', noUpdateAvailable: 'No updates found', - updateAvailable: 'An update is available!' + updateAvailable: 'An update is available!', + wrongSpotifyUsername: '{username} is not a valid spotify username' }, settings: { title: 'Settings', diff --git a/src/lang/it.mjs b/src/lang/it.mjs index 1f92e42..6857fde 100644 --- a/src/lang/it.mjs +++ b/src/lang/it.mjs @@ -223,7 +223,8 @@ const it = { noLovedPlaylist: 'Nessuna playlist "Canzoni del cuore"!', checkingUpdates: 'Cercando aggiornamenti...', noUpdateAvailable: 'Nessun aggiornamento trovato', - updateAvailable: 'È disponibile un aggiornamento!' + updateAvailable: 'È disponibile un aggiornamento!', + wrongSpotifyUsername: '{username} non è un username di Spotify valido' }, settings: { title: 'Impostazioni', diff --git a/src/use/favorites.js b/src/use/favorites.js index dbc6e6a..60926cb 100644 --- a/src/use/favorites.js +++ b/src/use/favorites.js @@ -2,6 +2,8 @@ import { ref, computed } from '@vue/composition-api' import store from '@/store' import { fetchData } from '@/utils/api' +import { toast } from '@/utils/toasts' +import i18n from '@/plugins/i18n' import { SPOTIFY_STATUS } from '@/constants' const favoriteArtists = ref([]) @@ -27,10 +29,18 @@ const setAllFavorites = data => { } const setSpotifyPlaylists = response => { - if (response.error === 'spotifyNotEnabled') { + if (response.error) { favoriteSpotifyPlaylists.value = [] - - store.dispatch('setSpotifyStatus', SPOTIFY_STATUS.DISABLED).catch(console.error) + switch (response.error) { + case 'spotifyNotEnabled': + store.dispatch('setSpotifyStatus', SPOTIFY_STATUS.DISABLED).catch(console.error) + break + case 'wrongSpotifyUsername': + toast(i18n.t('toasts.wrongSpotifyUsername', { username: response.username }), 'person_off') + break + default: + break + } return }