fix(dashboard,types): Fix TS errors (#10457)

**What**
- Fixes TS erros in dashboard project
- Updates incorrect HTTP Invite types
- Fixes incorrectly formatted dates in dashboard
This commit is contained in:
Kasper Fabricius Kristensen
2024-12-08 12:51:13 +01:00
committed by GitHub
parent 55f5ce4690
commit 864f53011b
28 changed files with 120 additions and 252 deletions

View File

@@ -2,11 +2,11 @@ import { Heading, Input, Select, clx } from "@medusajs/ui"
import { useTranslation } from "react-i18next"
import { z } from "zod"
import { HttpTypes } from "@medusajs/types"
import { Control } from "react-hook-form"
import { AddressSchema } from "../../../lib/schemas"
import { Form } from "../../common/form"
import { CountrySelect } from "../../inputs/country-select"
import { HttpTypes } from "@medusajs/types"
type AddressFieldValues = z.infer<typeof AddressSchema>
@@ -187,14 +187,24 @@ export const AddressForm = ({
<Select.Value />
</Select.Trigger>
<Select.Content>
{countries.map((country) => (
<Select.Item
key={country.iso_2}
value={country.iso_2}
>
{country.display_name}
</Select.Item>
))}
{countries.map((country) => {
/**
* If a country does not have an ISO 2 code, it is not
* a valid country and should not be selectable.
*/
if (!country.iso_2) {
return null
}
return (
<Select.Item
key={country.iso_2}
value={country.iso_2}
>
{country.display_name}
</Select.Item>
)
})}
</Select.Content>
</Select>
) : (

View File

@@ -18,7 +18,7 @@ import {
Trash,
} from "@medusajs/icons"
import { FetchError } from "@medusajs/js-sdk"
import { ComponentPropsWithoutRef, forwardRef, useRef } from "react"
import { ComponentPropsWithoutRef, forwardRef } from "react"
import { ConditionalTooltip } from "../../common/conditional-tooltip"
import { Form } from "../../common/form"
import { InlineTip } from "../../common/inline-tip"
@@ -78,7 +78,6 @@ const InnerForm = <TRes,>({
const { t } = useTranslation()
const { handleSuccess } = useRouteModal()
const deletedOriginalRows = useRef<string[]>([])
const hasUneditableRows = getHasUneditableRows(metadata)
const form = useForm<z.infer<typeof MetadataSchema>>({