Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function create() {
const postData = {...form, status: PostStatus.INACTIVE}
await DataStore.save(
new Post(postData)
);
console.log('successfully created new post')
updateForm({ title: '', rating: '' })
}
useEffect(() => {
function onCreate() {
DataStore.save(
new Post({
title: `New title ${Date.now()}`,
rating: (function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive
})(1, 7),
status: PostStatus.ACTIVE
})
);
}