Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(async (resolve, reject) => {
if (!title) {
return reject(new TypeError('title is required'))
}
const { user } = getUser()
const id = await uid(20)
const task = {
id,
title,
description,
project,
createdAt: new Date(),
updatedAt: new Date(),
type: tab.toLowerCase()
}
const tasks = [...user.tasks, task]
user.tasks = tasks
resolve(localStorage.setItem('taskr', JSON.stringify({ user })))
})
}