added confirm dialog, some translations
This commit is contained in:
@@ -56,9 +56,6 @@ export function useCreateCurrencyRate() {
|
||||
queryClient.invalidateQueries({ queryKey: currencyRateKeys.lists() })
|
||||
toast.success(t('currencyRates.toast.created', 'Walýuta kursy döredildi'))
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t('currencyRates.toast.createError', 'Döretmek başartmady'))
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -75,9 +72,6 @@ export function useUpdateCurrencyRate(id: number) {
|
||||
queryClient.invalidateQueries({ queryKey: currencyRateKeys.detail(id) })
|
||||
toast.success(t('currencyRates.toast.updated', 'Walýuta kursy üýtgedildi'))
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t('currencyRates.toast.updateError', 'Üýtgetmek başartmady'))
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -93,8 +87,5 @@ export function useDeleteCurrencyRate() {
|
||||
queryClient.invalidateQueries({ queryKey: currencyRateKeys.lists() })
|
||||
toast.success(t('currencyRates.toast.deleted', 'Walýuta kursy pozuldy'))
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t('currencyRates.toast.deleteError', 'Pozmak başartmady'))
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
import { z } from 'zod'
|
||||
import i18next from 'i18next'
|
||||
import type { CreateCurrencyRatePayload, CurrencyCode } from '../api/currencyRatesApi'
|
||||
|
||||
const t = i18next.t.bind(i18next)
|
||||
|
||||
export const currencyRateFormSchema = z.object({
|
||||
currencyFrom: z.string().min(1, 'Hökmany meýdan'),
|
||||
currencyTo: z.string().min(1, 'Hökmany meýdan'),
|
||||
currencyFrom: z.string().min(1, t('validation.required', 'Hökmany meýdan')),
|
||||
currencyTo: z.string().min(1, t('validation.required', 'Hökmany meýdan')),
|
||||
value: z
|
||||
.string()
|
||||
.min(1, 'Hökmany meýdan')
|
||||
.refine((v) => !isNaN(Number(v)) && Number(v) > 0, 'Baha 0-dan uly bolmaly'),
|
||||
.min(1, t('validation.required', 'Hökmany meýdan'))
|
||||
.refine((v) => !isNaN(Number(v)) && Number(v) > 0, t('validation.valuePositive', 'Baha 0-dan uly bolmaly')),
|
||||
})
|
||||
|
||||
export type CurrencyRateFormData = z.infer<typeof currencyRateFormSchema>
|
||||
|
||||
Reference in New Issue
Block a user