|
1
|
import { useParams } from "react-router-dom" |
|
2
|
import { RouteFocusModal } from "../../../components/modals" |
|
3
|
import { useTaxRegion } from "../../../hooks/api/tax-regions" |
|
4
|
import { TaxRegionProvinceCreateForm } from "./components/tax-region-province-create-form" |
|
5
|
|
|
6
|
export const TaxProvinceCreate = () => { |
|
7
|
const { id } = useParams() |
|
8
|
|
|
9
|
const { tax_region, isPending, isError, error } = useTaxRegion(id!) |
|
10
|
|
|
11
|
const ready = !isPending && !!tax_region |
|
12
|
|
|
13
|
if (isError) { |
|
14
|
throw error |
|
15
|
} |
|
16
|
|
|
17
|
return ( |
|
18
|
<RouteFocusModal> |
|
19
|
{ready && <TaxRegionProvinceCreateForm parent={tax_region} />} |
|
20
|
</RouteFocusModal> |
|
21
|
) |
|
22
|
} |