Handle errors correctly for 400 Bad Requests & Rationalize colors

This commit is contained in:
root
2023-04-05 23:12:40 +05:30
parent 4c13d03024
commit e776a4de97
2 changed files with 34 additions and 22 deletions
+14 -14
View File
@@ -38,25 +38,25 @@ export default new Vuetify({
})(),
themes: {
light: {
primary: '#455A64',
secondary: '#5D4037',
accent: '#651FFF',
error: '#651FFF',
warning: '#FFC400',
info: '#8D6E63',
success: '#00E676',
primary: '#2e5d62',
secondary: '#eb7399',
accent: '#c3efca',
error: '#ec4734',
warning: '#e8efc3',
info: '#c3e8ef',
success: '#efc3d2',
bgOne: '#FAFAFA',
bgTwo: '#ECEFF1'
},
dark: {
primary: '#78909C',
secondary: '#8D6E63',
accent: '#FF1744',
error: '#651FFF',
warning: '#FFC400',
info: '#8D6E63',
success: '#00E676',
primary: '#5c6bc0',
secondary: '#5c9dc0',
accent: '#7f5cc0',
error: '#c05c6b',
warning: '#e8dd7b',
info: '#3949ab',
success: '#b15cc0',
bgOne: '#212121',
bgTwo: '#424242'
+20 -8
View File
@@ -61,15 +61,27 @@ const AuthenticationStore = {
async loginOrRegister ({ commit, rootGetters }, { path, username, password }) {
const apiURL = rootGetters['prefs/apiUrl']
const { data: resp } = await axios({
method: 'POST',
baseURL: apiURL,
url: '/' + path,
data: {
username,
password
let resp
try {
const data = await axios({
method: 'POST',
baseURL: apiURL,
url: '/' + path,
data: {
username,
password
}
})
resp = data.data
} catch (e) {
if (e.response.status === 400) {
const errorData = e.response.data
if ('error' in errorData) {
throw new AuthenticationError(errorData.error)
}
}
})
throw e
}
if ('error' in resp) {
throw new AuthenticationError(resp.error)