diff --git a/src/stores/accountStore.ts b/src/stores/accountStore.ts index b5962d334692a0f5a9c407cb346b303677c1009b..d0d7715190bedd53d676fa1193145768037f2774 100644 --- a/src/stores/accountStore.ts +++ b/src/stores/accountStore.ts @@ -16,20 +16,20 @@ export const useAccountStore = defineStore('account', { } try { - const response = await authInterceptor.post('/accounts', payload); - console.log('Success:', response.data); + const response = await authInterceptor.post('/accounts', payload) + console.log('Success:', response.data) } catch (error) { - console.error('Error posting account:', error); - this.handleAxiosError(error); + console.error('Error posting account:', error) + this.handleAxiosError(error) } }, handleAxiosError(error: any) { - const axiosError = error as AxiosError; + const axiosError = error as AxiosError if (axiosError.response && axiosError.response.data) { - const errorData = axiosError.response.data as { message: string }; + const errorData = axiosError.response.data as { message: string } } else { - this.errorMessage = 'An unexpected error occurred'; + this.errorMessage = 'An unexpected error occurred' } } } -}); +}) diff --git a/src/views/ConfigAccountNumberView.vue b/src/views/ConfigAccountNumberView.vue index e2c6227e5097dec9d2f4ca8c517697228020298e..4bd7792521fe37be1cb0c8781d1ef0416ec92648 100644 --- a/src/views/ConfigAccountNumberView.vue +++ b/src/views/ConfigAccountNumberView.vue @@ -62,19 +62,17 @@ const isFormValid = computed(() => { ) }) - async function onButtonClick() { - const savingAccountNumber = savingsAccount.value.replace(/\./g, ''); - const spendingAccountNumber = spendingAccount.value.replace(/\./g, ''); + const savingAccountNumber = savingsAccount.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) { const inputValue = (event.target as HTMLInputElement)?.value if (inputValue !== undefined) {