Skip to content
Snippets Groups Projects
Commit 9cf9509b authored by Eline Evje's avatar Eline Evje
Browse files

chore: ran npm format

parent 7d55d59e
No related branches found
No related tags found
3 merge requests!66Final merge,!36Enhancement/implement account number to config,!4Pipeline fix
Pipeline #280007 passed
...@@ -16,20 +16,20 @@ export const useAccountStore = defineStore('account', { ...@@ -16,20 +16,20 @@ export const useAccountStore = defineStore('account', {
} }
try { try {
const response = await authInterceptor.post('/accounts', payload); const response = await authInterceptor.post('/accounts', payload)
console.log('Success:', response.data); console.log('Success:', response.data)
} catch (error) { } catch (error) {
console.error('Error posting account:', error); console.error('Error posting account:', error)
this.handleAxiosError(error); this.handleAxiosError(error)
} }
}, },
handleAxiosError(error: any) { handleAxiosError(error: any) {
const axiosError = error as AxiosError; const axiosError = error as AxiosError
if (axiosError.response && axiosError.response.data) { if (axiosError.response && axiosError.response.data) {
const errorData = axiosError.response.data as { message: string }; const errorData = axiosError.response.data as { message: string }
} else { } else {
this.errorMessage = 'An unexpected error occurred'; this.errorMessage = 'An unexpected error occurred'
} }
} }
} }
}); })
...@@ -62,19 +62,17 @@ const isFormValid = computed(() => { ...@@ -62,19 +62,17 @@ const isFormValid = computed(() => {
) )
}) })
async function onButtonClick() { async function onButtonClick() {
const savingAccountNumber = savingsAccount.value.replace(/\./g, ''); const savingAccountNumber = savingsAccount.value.replace(/\./g, '')
const spendingAccountNumber = spendingAccount.value.replace(/\./g, ''); const spendingAccountNumber = spendingAccount.value.replace(/\./g, '')
await accountStore.postAccount('SAVING', savingAccountNumber, 0); await accountStore.postAccount('SAVING', savingAccountNumber, 0)
await accountStore.postAccount('SPENDING', spendingAccountNumber, 0); await accountStore.postAccount('SPENDING', spendingAccountNumber, 0)
await router.push({ name: 'home' }); await router.push({ name: 'home' })
} }
function restrictToNumbers(event: InputEvent, type: string) { function restrictToNumbers(event: InputEvent, type: string) {
const inputValue = (event.target as HTMLInputElement)?.value const inputValue = (event.target as HTMLInputElement)?.value
if (inputValue !== undefined) { if (inputValue !== undefined) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment