mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
16 lines
571 B
TypeScript
16 lines
571 B
TypeScript
import { msg } from "@lingui/core/macro"
|
|
import { useLingui } from "@lingui/react"
|
|
import { useAppSelector } from "@/app/store"
|
|
|
|
export function useValidationRules() {
|
|
const minimumPasswordLength = useAppSelector(state => state.server.serverInfos?.minimumPasswordLength)
|
|
const { _ } = useLingui()
|
|
|
|
return {
|
|
password: (value: string | undefined) =>
|
|
value && minimumPasswordLength && value.length < minimumPasswordLength
|
|
? _(msg`Password must be at least ${minimumPasswordLength} characters`)
|
|
: null,
|
|
}
|
|
}
|