Created
May 2, 2020 12:57
-
-
Save a7v8x/6b69771ab21b3476195320619e533edd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import genId from "../lib/gen-id"; | |
import tasks from "../db/tasks-db"; | |
export const createTask = (input) => { | |
const newTask = { | |
id: genId(), | |
...input, | |
createdAt: new Date().toISOString(), | |
updatedAt: new Date().toISOString(), | |
}; | |
tasks.unshift(newTask); | |
return newTask; | |
}; | |
export const getTaskById = id => tasks.find(task => task.id === id) | |
export const getTasks = () => tasks; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment