mirror of
https://github.com/nextcloud/server.git
synced 2026-02-19 02:38:40 -05:00
refactor(theming): use isAxiosError for error handling
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
This commit is contained in:
parent
0a5f75e719
commit
347c509308
1 changed files with 3 additions and 3 deletions
|
|
@ -7,7 +7,7 @@
|
|||
import type { AdminThemingParameters } from '../../types.d.ts'
|
||||
|
||||
import { mdiImageOutline, mdiUndo } from '@mdi/js'
|
||||
import axios from '@nextcloud/axios'
|
||||
import axios, { isAxiosError } from '@nextcloud/axios'
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
import { loadState } from '@nextcloud/initial-state'
|
||||
import { t } from '@nextcloud/l10n'
|
||||
|
|
@ -76,8 +76,8 @@ async function onChange() {
|
|||
})
|
||||
mime.value = file.type
|
||||
emit('updated')
|
||||
} catch (error: any) {
|
||||
if (error?.response?.status === 422) {
|
||||
} catch (error) {
|
||||
if (isAxiosError(error) && error.response?.status === 422) {
|
||||
const serverMessage = error.response.data?.data?.message
|
||||
showError(serverMessage || t('theming', 'Failed to upload image'))
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue