diff --git a/.env b/.env index fb7a36c..43d9218 100644 --- a/.env +++ b/.env @@ -1,6 +1,6 @@ VITE_TOKEN_NAME = 'dsc_token' VITE_REFRESH_TOKEN_NAME = 'dsc_refresh_token' VITE_DANAK_BASE_URL ='https://api.danakcorp.com' -VITE_BASE_URL = 'http://192.168.1.134:4000' -# VITE_BASE_URL = 'https://dmail-api.danakcorp.com' +# VITE_BASE_URL = 'http://192.168.1.134:4000' +VITE_BASE_URL = 'https://dmail-api.danakcorp.com' VITE_SERVICE_ID = 'e51afdc3-ea0b-49cf-8f49-2a6f131b024e' diff --git a/src/pages/setting/address/Address.tsx b/src/pages/setting/address/Address.tsx index 912537a..199a905 100644 --- a/src/pages/setting/address/Address.tsx +++ b/src/pages/setting/address/Address.tsx @@ -2,7 +2,7 @@ import Input from '@/components/Input' import Select from '@/components/Select' import Table from '@/components/Table' import { ColumnType } from '@/components/types/TableTypes' -import { FC, useState } from 'react' +import { FC, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import Button from '@/components/Button' import { TickCircle } from 'iconsax-react' @@ -35,11 +35,11 @@ const Address: FC = () => { const { data: domain } = useGetDomains() const { mutate: createAddress, isPending } = useCreateAddress() const { data: addresses, isPending: isPendingAddress } = useGetAddress(search, status) - const { register, handleSubmit, formState: { errors }, + const { register, handleSubmit, formState: { errors }, setValue } = useForm({ resolver: yupResolver(schema), defaultValues: { - domainId: domain?.data?.domain?.id || '', + domainId: domain?.data?.domain?.id, } }) @@ -100,6 +100,14 @@ const Address: FC = () => { }) } + useEffect(() => { + if (domain?.data?.domain?.id) { + setValue('domainId', domain?.data?.domain?.id) + } + }, [domain]) + + + return (