Enhance API document
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
|
||||
// - Import action types
|
||||
import * as types from 'actionTypes'
|
||||
|
||||
|
||||
/**
|
||||
* Default state
|
||||
*/
|
||||
var defaultState = {
|
||||
downloadFileName: '',
|
||||
uploadFileName:'',
|
||||
error: {},
|
||||
result: {}
|
||||
}
|
||||
|
||||
/**
|
||||
* File reducer
|
||||
* @param {object} state
|
||||
* @param {object} action
|
||||
*/
|
||||
export const fileReducer = (state = defaultState, action) => {
|
||||
switch (action.type) {
|
||||
case types.UPLOAD_FILE:
|
||||
return{
|
||||
...state,
|
||||
uploadFileName: action.fileName
|
||||
}
|
||||
case types.UPLOAD_FILE_ERROR:
|
||||
return{
|
||||
state,
|
||||
error: action.error
|
||||
}
|
||||
case types.UPLOAD_FILE_COMPLETE:
|
||||
return{
|
||||
...state,
|
||||
result: action.result
|
||||
}
|
||||
case types.DOWNLOAD_FILE:
|
||||
return{
|
||||
...state,
|
||||
downloadFileName: action.fileName
|
||||
}
|
||||
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
// - Import action types
|
||||
import * as types from 'actionTypes'
|
||||
|
||||
|
||||
/**
|
||||
* Default state for reducer
|
||||
*/
|
||||
var defaultState = {
|
||||
status: false,
|
||||
editStatus:false
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Image uploader reducer
|
||||
* @param {object} state
|
||||
* @param {object} action
|
||||
*/
|
||||
export var imageUploaderReducer = (state = defaultState, action) => {
|
||||
switch (action.type) {
|
||||
case types.OPEN_IMAGE_UPLOADER:
|
||||
if(action.status)
|
||||
{
|
||||
return{
|
||||
...state,
|
||||
status: true
|
||||
}
|
||||
}
|
||||
else{
|
||||
return{
|
||||
...state,
|
||||
status: false,
|
||||
editStatus: false
|
||||
}
|
||||
}
|
||||
case types.OPEN_IMAGE_EDITOR:
|
||||
return{
|
||||
...state,
|
||||
editStatus: action.editStatus
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user