@sanity/scheduled-publishing
Version:
> [!IMPORTANT] > As of [v3.39.0](https://www.sanity.io/changelog/e6013ee5-8214-4e03-9593-f7b19124b8a3) of Sanity Studio, this plugin has been deprecated and the Scheduled Publishing functionality has been moved into the core studio package. > Read more an
13 lines (10 loc) • 588 B
text/typescript
import {useState} from 'react'
import {Schedule, ScheduledDocValidations, ValidationStatus} from '../types'
const EMPTY_VALIDATIONS: ScheduledDocValidations = {}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export function useValidations() {
const [validations, setValidations] = useState<ScheduledDocValidations>(EMPTY_VALIDATIONS)
const updateValidation = (s: Schedule, vs: ValidationStatus) =>
setValidations((current) => ({...current, [s.id]: vs}))
return [validations, updateValidation] as [typeof validations, typeof updateValidation]
}