Enhance API document
This commit is contained in:
@@ -90,7 +90,7 @@ export var dbAddFollowingUser = (cid, userFollowing) => {
|
||||
|
||||
|
||||
/**
|
||||
* Add a user in a circle
|
||||
* Delete a user from a circle
|
||||
* @param {string} cid is circle identifier
|
||||
* @param {string} followingId following user identifier
|
||||
*/
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
// - Import react components
|
||||
import moment from 'moment'
|
||||
|
||||
// - Import image gallery action types
|
||||
import * as types from 'actionTypes'
|
||||
|
||||
// - Import actions
|
||||
import * as imageGalleryActions from 'imageGalleryActions'
|
||||
|
||||
// - Import firebase
|
||||
import {storageRef,firebaseRef} from 'app/firebase/'
|
||||
|
||||
|
||||
// - Upload file start
|
||||
export const uploadFile = (file) => {
|
||||
return (dispatch,getState) => {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// - Upload file error
|
||||
export const uploadError = (error) => {
|
||||
return{
|
||||
type: types.UPLOAD_FILE_ERROR,
|
||||
error
|
||||
}
|
||||
}
|
||||
|
||||
// - Uplaod file complete
|
||||
export const uploadComplete = (result) => {
|
||||
return{
|
||||
type: types.UPLOAD_FILE_COMPLETE,
|
||||
result
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// - Download file
|
||||
export const downloadFile = (fileName) => {
|
||||
return {
|
||||
type: types.DOWNLOAD_FILE,
|
||||
fileName
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// - Import image uploader action types
|
||||
import * as types from 'actionTypes'
|
||||
|
||||
|
||||
// - Image uploader actions
|
||||
|
||||
export const openImageUploader = (status)=> {
|
||||
return {
|
||||
type: types.OPEN_IMAGE_UPLOADER,
|
||||
status
|
||||
}
|
||||
}
|
||||
|
||||
export const openImageEditor = (editStatus) =>{
|
||||
return{
|
||||
type: types.OPEN_IMAGE_EDITOR,
|
||||
editStatus
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,10 @@ import {createLogger} from 'redux-logger';
|
||||
|
||||
// - Import reducers
|
||||
import {imageGalleryReducer} from 'imageGalleryReducer'
|
||||
import {imageUploaderReducer} from 'imageUploaderReducer'
|
||||
import {postReducer} from 'postReducer'
|
||||
import {commentReducer} from 'commentReducer'
|
||||
import {voteReducer} from 'voteReducer'
|
||||
import {authorizeReducer} from 'authorizeReducer'
|
||||
import {fileReducer} from 'fileReducer'
|
||||
import {globalReducer} from 'globalReducer'
|
||||
import {userReducer} from 'userReducer'
|
||||
import {circleReducer} from 'circleReducer'
|
||||
@@ -28,14 +26,12 @@ const logger = createLogger()
|
||||
// - Reducers
|
||||
var reducer = redux.combineReducers({
|
||||
imageGallery: imageGalleryReducer,
|
||||
imageUploader: imageUploaderReducer,
|
||||
post: postReducer,
|
||||
circle: circleReducer,
|
||||
comment: commentReducer,
|
||||
vote: voteReducer,
|
||||
authorize: authorizeReducer,
|
||||
router: routerReducer,
|
||||
file: fileReducer,
|
||||
user: userReducer,
|
||||
notify:notifyReducer,
|
||||
global: globalReducer
|
||||
|
||||
@@ -6,7 +6,7 @@ This layer is responsible for implementing actions for entities. [Actions](http:
|
||||
|
||||
We provide some actions to authorize a user. The authorize actions include singup, login, logout and update password for a user.
|
||||
|
||||
### Functions
|
||||
### Authorize Action Functions
|
||||
|
||||
```jsx
|
||||
dbLogin = (email, password) => {}
|
||||
@@ -54,4 +54,98 @@ This action is responsible to create new user state on reducer.
|
||||
updatePassword = () => {}
|
||||
```
|
||||
|
||||
This action is responsible to fire reducer method on update password.
|
||||
This action is responsible to fire reducer method on update password.
|
||||
|
||||
## circleActions.jsx
|
||||
|
||||
We provide some actions to authorize a user. The authorize actions include singup, login, logout and update password for a user.
|
||||
|
||||
### Circle Action Functions
|
||||
|
||||
```jsx
|
||||
dbAddCircle = (circleName) => {}
|
||||
```
|
||||
|
||||
Add a circle on the database. `circleName` is the name of the circle.
|
||||
|
||||
```jsx
|
||||
dbAddFollowingUser = (cid, userFollowing) => {}
|
||||
```
|
||||
|
||||
Add a user in a circle on the server. `cid` is the identifier of that circle. `userFollowing` is an object of the user which we want to add in a circle.
|
||||
|
||||
```jsx
|
||||
dbDeleteFollowingUser = (cid, followingId) => {}
|
||||
```
|
||||
|
||||
Delete a user from a circle on the server. `cid` is the identifier of that circle. `userFollowing` is an object of the user which we want to from a circle.
|
||||
|
||||
```jsx
|
||||
dbUpdateCircle = (newCircle) => {}
|
||||
```
|
||||
|
||||
Update a circle. `newCircle` is a circle object which should be updated.
|
||||
|
||||
```jsx
|
||||
dbDeleteCircle = (id) => {}
|
||||
```
|
||||
|
||||
Update a circle on the server. `id` is the circle identifier.
|
||||
|
||||
```jsx
|
||||
dbGetCircles = () => {}
|
||||
```
|
||||
|
||||
Get all circles of current user from server.
|
||||
|
||||
```jsx
|
||||
dbGetCirclesByUserId = (uid) => {}
|
||||
```
|
||||
|
||||
Get all circles of a specific user from server. `uid` is the user identifier.
|
||||
|
||||
```jsx
|
||||
addCircle = (uid, circle) => {}
|
||||
```
|
||||
|
||||
Add a circle in redux store. `uid` is the user identifier which we want to add `circle` to, from redux store.
|
||||
|
||||
```jsx
|
||||
updateCircle = (uid, circle) => {}
|
||||
```
|
||||
|
||||
Add a circle in redux store. `uid` is the user identifier which we want to update `circle` for, from redux store.
|
||||
|
||||
```jsx
|
||||
deleteCircle = (uid, id)}
|
||||
```
|
||||
|
||||
Delete a circle with `id` identifier which the user with `uid` identifier is the owner of that circle, from redux store.
|
||||
|
||||
## commentActions.jsx
|
||||
|
||||
### Comment Action Functions
|
||||
|
||||
## globalActions.jsx
|
||||
|
||||
### Global Action Functions
|
||||
|
||||
## imageGalleryActions.jsx
|
||||
|
||||
### Image Gallery Action Functions
|
||||
|
||||
## notifyActions.jsx
|
||||
|
||||
### Notify Action Functions
|
||||
|
||||
## postActions.jsx
|
||||
|
||||
### Post Action Functions
|
||||
|
||||
## userActions.jsx
|
||||
|
||||
### User Action Functions
|
||||
|
||||
## voteActions.jsx
|
||||
|
||||
### Vote Action Functions
|
||||
|
||||
Reference in New Issue
Block a user