How to use the @dojo/framework/stores/process.createProcess function in @dojo/framework

To help you get started, we’ve selected a few @dojo/framework examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dojo / examples / realworld / src / processes / articleProcesses.ts View on Github external
await fetch(`${baseUrl}/articles/${slug}`, {
		method: "delete",
		headers: getHeaders(token)
	});
	return [replace(path("routing", "outlet"), "home")];
});

export const getArticleProcess = createProcess("get-article", [
	startLoadingArticleCommand,
	[loadArticleCommand, loadCommentsCommand]
]);
export const deleteCommentProcess = createProcess("delete-comment", [deleteCommentCommand]);
export const addCommentProcess = createProcess("add-comment", [addCommentCommand]);
export const newCommentInputProcess = createProcess("new-comment-input", [newCommentInputCommand]);
export const favoriteArticleProcess = createProcess("fav-article", [favoriteArticleCommand]);
export const followUserProcess = createProcess("follow-user", [followUserCommand]);
export const deleteArticleProcess = createProcess("delete-article", [deleteArticleCommand]);
github gothinkster / dojo-realworld-example-app / src / processes / settingsProcesses.ts View on Github external
return [
		replace(path("session"), json.user),
		replace(path("settings"), undefined),
		replace(path("routing", "outlet"), "user"),
		replace(path("routing", "params"), { username: get(path("settings", "username")) })
	];
});

export const getUserSettingsProcess = createProcess("user-settings", [
	startUserSettingsCommand,
	getUserSettingsCommand
]);
export const updateUserSettingsProcess = createProcess("update-user-settings", [updateUserSettingsCommand]);
export const usernameInputProcess = createProcess("username-input", [usernameInputCommand]);
export const emailInputProcess = createProcess("email-input", [emailInputCommand]);
export const passwordInputProcess = createProcess("password-input", [passwordInputCommand]);
export const bioInputProcess = createProcess("bio-input", [bioInputCommand]);
export const imageUrlInputProcess = createProcess("image-url-input", [imageUrlInputCommand]);
github dojo / examples / realworld / src / processes / editorProcesses.ts View on Github external
const json = await response.json();

	if (!response.ok) {
		return [replace(path('editor', 'loading'), false), replace(path('errors'), json.errors)];
	}

	return [
		replace(path('article', 'item'), json.article),
		replace(path('article', 'loaded'), true),
		replace(path('editor'), undefined)
	];
});

export const titleInputProcess = createProcess('title-input', [titleInputCommand]);
export const descInputProcess = createProcess('desc-input', [descriptionInputCommand]);
export const bodyInputProcess = createProcess('body-input', [bodyInputCommand]);
export const tagInputProcess = createProcess('tag-input', [tagInputCommand]);
export const addTagProcess = createProcess('add-tag', [addTagCommand, clearTagInputCommand]);
export const removeTagProcess = createProcess('remove-tag', [removeTagCommand]);
export const getEditorArticleProcess = createProcess('get-editor-article', [getArticleForEditorCommand]);
export const publishArticleProcess = createProcess('publish-article', [startPublishCommand, publishArticleCommand]);
export const clearEditorProcess = createProcess('clear-editor', [clearEditorCommand]);
github gothinkster / dojo-realworld-example-app / src / processes / settingsProcesses.ts View on Github external
method: "put",
		headers: getHeaders(token),
		body: JSON.stringify(requestPayload)
	});

	const json = await response.json();

	return [
		replace(path("session"), json.user),
		replace(path("settings"), undefined),
		replace(path("routing", "outlet"), "user"),
		replace(path("routing", "params"), { username: get(path("settings", "username")) })
	];
});

export const getUserSettingsProcess = createProcess("user-settings", [
	startUserSettingsCommand,
	getUserSettingsCommand
]);
export const updateUserSettingsProcess = createProcess("update-user-settings", [updateUserSettingsCommand]);
export const usernameInputProcess = createProcess("username-input", [usernameInputCommand]);
export const emailInputProcess = createProcess("email-input", [emailInputCommand]);
export const passwordInputProcess = createProcess("password-input", [passwordInputCommand]);
export const bioInputProcess = createProcess("bio-input", [bioInputCommand]);
export const imageUrlInputProcess = createProcess("image-url-input", [imageUrlInputCommand]);
github gothinkster / dojo-realworld-example-app / src / processes / settingsProcesses.ts View on Github external
replace(path("session"), json.user),
		replace(path("settings"), undefined),
		replace(path("routing", "outlet"), "user"),
		replace(path("routing", "params"), { username: get(path("settings", "username")) })
	];
});

export const getUserSettingsProcess = createProcess("user-settings", [
	startUserSettingsCommand,
	getUserSettingsCommand
]);
export const updateUserSettingsProcess = createProcess("update-user-settings", [updateUserSettingsCommand]);
export const usernameInputProcess = createProcess("username-input", [usernameInputCommand]);
export const emailInputProcess = createProcess("email-input", [emailInputCommand]);
export const passwordInputProcess = createProcess("password-input", [passwordInputCommand]);
export const bioInputProcess = createProcess("bio-input", [bioInputCommand]);
export const imageUrlInputProcess = createProcess("image-url-input", [imageUrlInputCommand]);
github gothinkster / dojo-realworld-example-app / src / processes / settingsProcesses.ts View on Github external
return [
		replace(path("session"), json.user),
		replace(path("settings"), undefined),
		replace(path("routing", "outlet"), "user"),
		replace(path("routing", "params"), { username: get(path("settings", "username")) })
	];
});

export const getUserSettingsProcess = createProcess("user-settings", [
	startUserSettingsCommand,
	getUserSettingsCommand
]);
export const updateUserSettingsProcess = createProcess("update-user-settings", [updateUserSettingsCommand]);
export const usernameInputProcess = createProcess("username-input", [usernameInputCommand]);
export const emailInputProcess = createProcess("email-input", [emailInputCommand]);
export const passwordInputProcess = createProcess("password-input", [passwordInputCommand]);
export const bioInputProcess = createProcess("bio-input", [bioInputCommand]);
export const imageUrlInputProcess = createProcess("image-url-input", [imageUrlInputCommand]);
github dojo / examples / realworld / src / processes / editorProcesses.ts View on Github external
return [
		replace(path('article', 'item'), json.article),
		replace(path('article', 'loaded'), true),
		replace(path('editor'), undefined)
	];
});

export const titleInputProcess = createProcess('title-input', [titleInputCommand]);
export const descInputProcess = createProcess('desc-input', [descriptionInputCommand]);
export const bodyInputProcess = createProcess('body-input', [bodyInputCommand]);
export const tagInputProcess = createProcess('tag-input', [tagInputCommand]);
export const addTagProcess = createProcess('add-tag', [addTagCommand, clearTagInputCommand]);
export const removeTagProcess = createProcess('remove-tag', [removeTagCommand]);
export const getEditorArticleProcess = createProcess('get-editor-article', [getArticleForEditorCommand]);
export const publishArticleProcess = createProcess('publish-article', [startPublishCommand, publishArticleCommand]);
export const clearEditorProcess = createProcess('clear-editor', [clearEditorCommand]);
github dojo / examples / todo-mvc-kitchensink / src / todoProcesses.ts View on Github external
const initialStateCommand = commandFactory(({ path }) => {
	return [
		add(path('completedCount'), 0),
		add(path('completed'), false),
		add(path('currentSearch'), ''),
		add(path('currentTodo'), ''),
		add(path('editedTodo'), undefined),
		add(path('todoCount'), 0),
		add(path('todos'), {})
	];
});

export const initialStateProcess = createProcess('initial-state', [ initialStateCommand ]);

export const addTodoProcess = createProcess('add-todo', [ addTodoCommand, updateTodoCountsCommand, updateCompletedFlagCommand ]);

export const removeTodoProcess = createProcess('remove-todo', [ removeTodoCommand, updateTodoCountsCommand, updateCompletedFlagCommand ]);

export const toggleTodoProcess = createProcess('toggle-todo', [ toggleTodoCommand, updateTodoCountsCommand, updateCompletedFlagCommand ]);

export const toggleTodosProcess = createProcess('toggle-todos', [ toggleTodosCommand, updateTodoCountsCommand, updateCompletedFlagCommand ]);

export const editTodoProcess = createProcess('edit-todo', [ editTodoCommand ]);

export const clearCompletedProcess = createProcess('clear-completed', [ clearCompletedCommand, updateTodoCountsCommand, updateCompletedFlagCommand ]);

export const saveTodoProcess = createProcess('save-todo', [ saveTodoCommand ]);

export const searchProcess = createProcess('search', [ searchCommand ]);

export const setCurrentTodoProcess = createProcess('current-todo', [ setCurrentTodoCommand ]);
github dojo / examples / realworld / src / processes / loginProcesses.ts View on Github external
});

const logoutCommand = commandFactory(({ path }) => {
	global.sessionStorage.removeItem('conduit-session');
	return [replace(path('user'), {})];
});

export const loginProcess = createProcess('login', [startLoginCommand, loginCommand, clearLoginInputs]);
export const registerProcess = createProcess('register', [startRegisterCommand, registerCommand, clearRegisterInputs]);
export const loginEmailInputProcess = createProcess('login-email-input', [loginEmailInputCommand]);
export const loginPasswordInputProcess = createProcess('login-password-input', [loginPasswordInputCommand]);
export const registerEmailInputProcess = createProcess('register-email-input', [registerEmailInputCommand]);
export const registerPasswordInputProcess = createProcess('register-password-input', [registerPasswordInputCommand]);
export const registerUsernameInputProcess = createProcess('register-username-input', [registerUsernameInputCommand]);
export const setSessionProcess = createProcess('set-session', [setSessionCommand]);
export const logoutProcess = createProcess('logout', [logoutCommand]);
github dojo / examples / realworld / src / processes / editorProcesses.ts View on Github external
body: JSON.stringify(requestPayload)
	});
	const json = await response.json();

	if (!response.ok) {
		return [replace(path('editor', 'loading'), false), replace(path('errors'), json.errors)];
	}

	return [
		replace(path('article', 'item'), json.article),
		replace(path('article', 'loaded'), true),
		replace(path('editor'), undefined)
	];
});

export const titleInputProcess = createProcess('title-input', [titleInputCommand]);
export const descInputProcess = createProcess('desc-input', [descriptionInputCommand]);
export const bodyInputProcess = createProcess('body-input', [bodyInputCommand]);
export const tagInputProcess = createProcess('tag-input', [tagInputCommand]);
export const addTagProcess = createProcess('add-tag', [addTagCommand, clearTagInputCommand]);
export const removeTagProcess = createProcess('remove-tag', [removeTagCommand]);
export const getEditorArticleProcess = createProcess('get-editor-article', [getArticleForEditorCommand]);
export const publishArticleProcess = createProcess('publish-article', [startPublishCommand, publishArticleCommand]);
export const clearEditorProcess = createProcess('clear-editor', [clearEditorCommand]);