Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const handleCreateNewPrivateStory = async () => {
setLoadingCreate(true);
try {
const story = createNewEmptyStory();
if (storiesFile) {
storiesFile.stories.unshift(convertStoryToSubsetStory(story));
await saveStoriesFile(storiesFile);
await saveStoryFile(story);
Fathom.trackGoal(Goals.CREATE_NEW_STORY, 0);
router.push('/stories/[storyId]', `/stories/${story.id}`);
}
} catch (error) {
console.error(error);
toast.error(error.message);
setLoadingCreate(false);
}
};
const addAccount = async (account: Account) => {
if (!state.file) return;
Fathom.trackGoal(Goals.ADD_NEW_ACCOUNT, 0);
const file = state.file;
file.accounts.push(account);
await putFile(file);
dispatch({ type: 'success', file });
};
const handleLogin = () => {
Fathom.trackGoal(Goals.LOGIN, 0);
userSession.redirectToSignIn();
};
const handleLogin = () => {
Fathom.trackGoal(Goals.LOGIN, 0);
userSession.redirectToSignIn();
};