Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function useMarkdownForm(
markdownRemark: Markdown,
formOverrrides: FormOptions
) {
const cms = useCMS()
// let throttledOnChange = React.useMemo(() => {
// return throttle(cms.api.git.onChange, 300)
// }, [])
const [values, form] = useLocalForm({
label: markdownRemark.path,
id: markdownRemark.path,
initialValues: markdownRemark,
async onSubmit(data) {
console.log({ data })
await cms.api.git.onChange!({
fileRelativePath: data.path,
content: toMarkdownString(data),
})
return await cms.api.git.onSubmit!({
files: [data.path],
message: data.__commit_message || 'commit from tina',
name: data.__commit_name,
email: data.__commit_email || 'ncphillips.19@gmail.com',
})
},