|
1
|
import { RouteFocusModal } from "../../../components/modals/route-focus-modal" |
|
2
|
import { useStore } from "../../../hooks/api/store" |
|
3
|
import { currencies } from "../../../lib/data/currencies" |
|
4
|
import { CreateRegionForm } from "./components/create-region-form" |
|
5
|
|
|
6
|
export const RegionCreate = () => { |
|
7
|
const { store, isPending: isLoading, isError, error } = useStore() |
|
8
|
|
|
9
|
const storeCurrencies = (store?.supported_currencies ?? []) |
|
10
|
.map((c) => currencies[c.currency_code.toUpperCase()]) |
|
11
|
.filter(Boolean) |
|
12
|
|
|
13
|
if (isError) { |
|
14
|
throw error |
|
15
|
} |
|
16
|
|
|
17
|
return ( |
|
18
|
<RouteFocusModal> |
|
19
|
{!isLoading && store && <CreateRegionForm currencies={storeCurrencies} />} |
|
20
|
</RouteFocusModal> |
|
21
|
) |
|
22
|
} |