Skip to content

Instantly share code, notes, and snippets.

@mudivili
Created August 29, 2017 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mudivili/4c5af3b6142684f002199f212cada7b7 to your computer and use it in GitHub Desktop.
Save mudivili/4c5af3b6142684f002199f212cada7b7 to your computer and use it in GitHub Desktop.
<snippet>
<content><![CDATA[
export function create${1:ModelName}Response(data) {
AppDispatcher.handleServerAction({
actionType: constants.CREATE_${2:MODEL_NAME}_RESPONSE,
data: data
});
}
export function create${1:ModelName}Error(data) {
AppDispatcher.handleServerAction({
actionType: constants.CREATE_${2:MODEL_NAME}_ERROR,
data: data
});
}
export function update${1:ModelName}Response(data) {
AppDispatcher.handleServerAction({
actionType: constants.UPDATE_${2:MODEL_NAME}_RESPONSE,
data: data
});
}
export function update${1:ModelName}Error(data) {
AppDispatcher.handleServerAction({
actionType: constants.UPDATE_${2:MODEL_NAME}_ERROR,
data: data
});
}
export function fetch${1:ModelName}sResponse(data) {
AppDispatcher.handleServerAction({
actionType: constants.FETCH_${2:MODEL_NAME}S_RESPONSE,
data: data
});
}
export function fetch${1:ModelName}sError(data) {
AppDispatcher.handleServerAction({
actionType: constants.FETCH_${2:MODEL_NAME}S_ERROR,
data: data
});
}
export function remove${1:ModelName}Response(data) {
AppDispatcher.handleServerAction({
actionType: constants.REMOVE_${2:MODEL_NAME}_RESPONSE,
data: data
});
}
export function remove${1:ModelName}Error(data) {
AppDispatcher.handleServerAction({
actionType: constants.REMOVE_${2:MODEL_NAME}_ERROR,
data: data
});
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>server-action-crud</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment