feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334)
This commit is contained in:
committed by
GitHub
parent
d6b1ad1ccd
commit
40de54b010
22
packages/admin-ui/ui/src/utils/form-helpers.ts
Normal file
22
packages/admin-ui/ui/src/utils/form-helpers.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { DeepMap } from "react-hook-form"
|
||||
|
||||
export const stringOrNull = (value: string) => {
|
||||
return value === "" ? null : value
|
||||
}
|
||||
|
||||
export const numberOrNull = (value: string) => {
|
||||
const tmp = parseInt(value, 10)
|
||||
|
||||
return isNaN(tmp) ? null : tmp
|
||||
}
|
||||
|
||||
export const checkForDirtyState = (
|
||||
dirtyFields: DeepMap<Record<string, any>, true>,
|
||||
otherValues: Record<string, boolean>
|
||||
) => {
|
||||
const otherDirtyState = otherValues
|
||||
? Object.values(otherValues).some((v) => v)
|
||||
: false
|
||||
|
||||
return !!Object.keys(dirtyFields).length || otherDirtyState
|
||||
}
|
||||
Reference in New Issue
Block a user