Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
upsert(page: Page) {
if (!page.id) page.id = guid();
this.store.upsert(page.id, page);
}
add(page?: Page) {
const newPage: Page = {
id: guid(),
pageTitle: 'New Page',
pageTags: [],
blocks: [],
...page
};
this.store.add(newPage);
}
export async function addTodo(title) {
const todo = {
title,
completed: false,
};
const idFromServer = await Promise.resolve(guid());
todosStore.add({
id: idFromServer,
...todo
});
}
export function createTodo(title: Todo['title']) {
return {
id: guid(),
title,
completed: false
} as Todo;
}