Fixed modal fullscreen icons, made types compatible with server changes made for #174, npm update, npm run format, minor improvements
This commit is contained in:
@ -9,7 +9,7 @@ export async function register(username: string, email: string, password: string
|
||||
useCookies().set('token', response.data.token as string)
|
||||
return { success: true, token: response.data.token }
|
||||
} catch (error: any) {
|
||||
if (typeof error.response.data === 'undefined') {
|
||||
if (typeof error.response?.data === 'undefined') {
|
||||
return { error: 'Could not connect to server' }
|
||||
}
|
||||
return { error: error.response.data.message }
|
||||
@ -24,6 +24,9 @@ export async function login(username: string, password: string) {
|
||||
})
|
||||
return { success: true, token: response.data.token }
|
||||
} catch (error: any) {
|
||||
if (typeof error.response?.data === 'undefined') {
|
||||
return { error: 'Could not connect to server' }
|
||||
}
|
||||
return { error: error.response.data.message }
|
||||
}
|
||||
}
|
||||
@ -33,7 +36,7 @@ export async function resetPassword(email: string) {
|
||||
const response = await axios.post(`${config.server_endpoint}/reset-password`, { email })
|
||||
return { success: true, token: response.data.token }
|
||||
} catch (error: any) {
|
||||
if (typeof error.response.data === 'undefined') {
|
||||
if (typeof error.response?.data === 'undefined') {
|
||||
return { error: 'Could not connect to server' }
|
||||
}
|
||||
return { error: error.response.data.message }
|
||||
@ -45,7 +48,7 @@ export async function newPassword(urlToken: string, password: string) {
|
||||
const response = await axios.post(`${config.server_endpoint}/new-password`, { urlToken, password })
|
||||
return { success: true, token: response.data.token }
|
||||
} catch (error: any) {
|
||||
if (typeof error.response.data === 'undefined') {
|
||||
if (typeof error.response?.data === 'undefined') {
|
||||
return { error: 'Could not connect to server' }
|
||||
}
|
||||
return { error: error.response.data.message }
|
||||
|
Reference in New Issue
Block a user