Added invalid spotify username warning

This commit is contained in:
RemixDev 2022-05-28 14:41:01 +02:00
parent f29ff88e35
commit 416f5a2a04
3 changed files with 17 additions and 5 deletions

View File

@ -222,7 +222,8 @@ const en = {
noLovedPlaylist: 'No loved tracks playlist!', noLovedPlaylist: 'No loved tracks playlist!',
checkingUpdates: 'Checking for updates...', checkingUpdates: 'Checking for updates...',
noUpdateAvailable: 'No updates found', noUpdateAvailable: 'No updates found',
updateAvailable: 'An update is available!' updateAvailable: 'An update is available!',
wrongSpotifyUsername: '{username} is not a valid spotify username'
}, },
settings: { settings: {
title: 'Settings', title: 'Settings',

View File

@ -223,7 +223,8 @@ const it = {
noLovedPlaylist: 'Nessuna playlist "Canzoni del cuore"!', noLovedPlaylist: 'Nessuna playlist "Canzoni del cuore"!',
checkingUpdates: 'Cercando aggiornamenti...', checkingUpdates: 'Cercando aggiornamenti...',
noUpdateAvailable: 'Nessun aggiornamento trovato', noUpdateAvailable: 'Nessun aggiornamento trovato',
updateAvailable: 'È disponibile un aggiornamento!' updateAvailable: 'È disponibile un aggiornamento!',
wrongSpotifyUsername: '{username} non è un username di Spotify valido'
}, },
settings: { settings: {
title: 'Impostazioni', title: 'Impostazioni',

View File

@ -2,6 +2,8 @@ import { ref, computed } from '@vue/composition-api'
import store from '@/store' import store from '@/store'
import { fetchData } from '@/utils/api' import { fetchData } from '@/utils/api'
import { toast } from '@/utils/toasts'
import i18n from '@/plugins/i18n'
import { SPOTIFY_STATUS } from '@/constants' import { SPOTIFY_STATUS } from '@/constants'
const favoriteArtists = ref([]) const favoriteArtists = ref([])
@ -27,10 +29,18 @@ const setAllFavorites = data => {
} }
const setSpotifyPlaylists = response => { const setSpotifyPlaylists = response => {
if (response.error === 'spotifyNotEnabled') { if (response.error) {
favoriteSpotifyPlaylists.value = [] favoriteSpotifyPlaylists.value = []
switch (response.error) {
store.dispatch('setSpotifyStatus', SPOTIFY_STATUS.DISABLED).catch(console.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 return
} }