Added invalid spotify username warning
This commit is contained in:
parent
f29ff88e35
commit
416f5a2a04
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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 = []
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user