Improvment in tslint standard (#16)
This commit is contained in:
@@ -12,7 +12,7 @@ export class AuthorizeState {
|
||||
* @type {number}
|
||||
* @memberof AuthorizeState
|
||||
*/
|
||||
uid: number = 0;
|
||||
uid: number = 0
|
||||
|
||||
/**
|
||||
* If user is authed {true} or not {false}
|
||||
@@ -20,7 +20,7 @@ export class AuthorizeState {
|
||||
* @type {Boolean}
|
||||
* @memberof AuthorizeState
|
||||
*/
|
||||
authed: Boolean = false;
|
||||
authed: Boolean = false
|
||||
|
||||
/**
|
||||
* If user password is updated {true} or not {false}
|
||||
@@ -28,7 +28,7 @@ export class AuthorizeState {
|
||||
* @type {Boolean}
|
||||
* @memberof AuthorizeState
|
||||
*/
|
||||
updatePassword: Boolean = false;
|
||||
updatePassword: Boolean = false
|
||||
|
||||
/**
|
||||
* If the user is guest {true} or not {false}
|
||||
@@ -36,5 +36,5 @@ export class AuthorizeState {
|
||||
* @type {Boolean}
|
||||
* @memberof AuthorizeState
|
||||
*/
|
||||
guest: Boolean = false;
|
||||
guest: Boolean = false
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import {AuthorizeActionType} from 'constants/authorizeActionType'
|
||||
* @interface IAuthorizeAction
|
||||
*/
|
||||
export interface IAuthorizeAction {
|
||||
payload: any;
|
||||
type: AuthorizeActionType;
|
||||
payload: any
|
||||
type: AuthorizeActionType
|
||||
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
// - Import react components
|
||||
import {Reducer, Action} from "redux";
|
||||
import {Reducer, Action} from 'redux'
|
||||
|
||||
// - Import action types
|
||||
import {AuthorizeActionType} from 'constants/authorizeActionType'
|
||||
|
||||
import { IAuthorizeAction } from "./IAuthorizeAction";
|
||||
import { AuthorizeState } from "./AuthorizeState";
|
||||
import { IAuthorizeAction } from './IAuthorizeAction'
|
||||
import { AuthorizeState } from './AuthorizeState'
|
||||
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import { AuthorizeState } from "./AuthorizeState";
|
||||
* @param {object} state
|
||||
* @param {object} action
|
||||
*/
|
||||
export var authorizeReducer = (state : AuthorizeState = new AuthorizeState(), action: IAuthorizeAction) =>{
|
||||
const { payload } = action;
|
||||
export let authorizeReducer = (state : AuthorizeState = new AuthorizeState(), action: IAuthorizeAction) =>{
|
||||
const { payload } = action
|
||||
switch (action.type) {
|
||||
case AuthorizeActionType.LOGIN:
|
||||
return{
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { authorizeReducer } from "./authorizeReducer";
|
||||
import { authorizeReducer } from './authorizeReducer'
|
||||
|
||||
export {authorizeReducer};
|
||||
export {authorizeReducer}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Circle } from "domain/circles";
|
||||
import { Circle } from 'domain/circles'
|
||||
|
||||
/**
|
||||
* Circle state
|
||||
@@ -14,7 +14,7 @@ export class CircleState {
|
||||
* @type {({[userId: string]: {[circleId: string]: Circle}} | null)}
|
||||
* @memberof CircleState
|
||||
*/
|
||||
userCircles: {[userId: string]: {[circleId: string]: Circle}} = {};
|
||||
userCircles: {[userId: string]: {[circleId: string]: Circle}} = {}
|
||||
|
||||
/**
|
||||
* If user circles are loaded {true} or not {false}
|
||||
@@ -22,5 +22,5 @@ export class CircleState {
|
||||
* @type {Boolean}
|
||||
* @memberof CircleState
|
||||
*/
|
||||
loaded: Boolean = false;
|
||||
loaded: Boolean = false
|
||||
}
|
||||
@@ -3,14 +3,14 @@ import moment from 'moment'
|
||||
import _ from 'lodash'
|
||||
|
||||
// - Import domain
|
||||
import { User } from "domain/users";
|
||||
import { Circle } from "domain/circles";
|
||||
import { User } from 'domain/users'
|
||||
import { Circle } from 'domain/circles'
|
||||
|
||||
// - Import action types
|
||||
import {CircleActionType} from 'constants/circleActionType'
|
||||
|
||||
import { CircleState } from "./CircleState";
|
||||
import { ICircleAction } from "./ICircleAction";
|
||||
import { CircleState } from './CircleState'
|
||||
import { ICircleAction } from './ICircleAction'
|
||||
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ import { ICircleAction } from "./ICircleAction";
|
||||
* @param state
|
||||
* @param action
|
||||
*/
|
||||
export var circleReducer = (state: CircleState = new CircleState(), action: ICircleAction) => {
|
||||
export let circleReducer = (state: CircleState = new CircleState(), action: ICircleAction) => {
|
||||
const { payload } = action
|
||||
switch (action.type) {
|
||||
case CircleActionType.CLEAR_ALL_CIRCLES:
|
||||
return new CircleState();
|
||||
return new CircleState()
|
||||
|
||||
case CircleActionType.ADD_CIRCLE:
|
||||
return {
|
||||
@@ -156,7 +156,7 @@ export var circleReducer = (state: CircleState = new CircleState(), action: ICir
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
return state
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { circleReducer } from "./circleReducer";
|
||||
import { circleReducer } from './circleReducer'
|
||||
|
||||
export {circleReducer};
|
||||
export {circleReducer}
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import { Comment } from "domain/comments";
|
||||
import { Comment } from 'domain/comments'
|
||||
|
||||
/**
|
||||
* Comment state
|
||||
@@ -15,7 +15,7 @@ export class CommentState {
|
||||
* @type {({[postId: string]: {[commentId: string]: Comment}} | null)}
|
||||
* @memberof CommentState
|
||||
*/
|
||||
postComments: {[postId: string]: {[commentId: string]: Comment}} = {};
|
||||
postComments: {[postId: string]: {[commentId: string]: Comment}} = {}
|
||||
|
||||
/**
|
||||
* If the comments are loaded {true} or not {false}
|
||||
@@ -23,5 +23,5 @@ export class CommentState {
|
||||
* @type {Boolean}
|
||||
* @memberof CommentState
|
||||
*/
|
||||
loaded: Boolean = false;
|
||||
loaded: Boolean = false
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import {CommentActionType} from 'constants/commentActionType'
|
||||
* @interface ICommentAction
|
||||
*/
|
||||
export interface ICommentAction {
|
||||
payload: any;
|
||||
type: CommentActionType;
|
||||
payload: any
|
||||
type: CommentActionType
|
||||
|
||||
}
|
||||
@@ -3,23 +3,23 @@ import moment from 'moment'
|
||||
import _ from 'lodash'
|
||||
|
||||
// - Import domain
|
||||
import { User } from "domain/users";
|
||||
import { Comment } from "domain/comments";
|
||||
import { User } from 'domain/users'
|
||||
import { Comment } from 'domain/comments'
|
||||
|
||||
// - Import action types
|
||||
import {CommentActionType} from 'constants/commentActionType'
|
||||
|
||||
|
||||
import { CommentState } from "./CommentState";
|
||||
import { ICommentAction } from "./ICommentAction";
|
||||
import { CommentState } from './CommentState'
|
||||
import { ICommentAction } from './ICommentAction'
|
||||
|
||||
/**
|
||||
* Comment reducer
|
||||
* @param state
|
||||
* @param action
|
||||
*/
|
||||
export var commentReducer = (state: CommentState = new CommentState(), action: ICommentAction) => {
|
||||
var { payload } = action
|
||||
export let commentReducer = (state: CommentState = new CommentState(), action: ICommentAction) => {
|
||||
let { payload } = action
|
||||
switch (action.type) {
|
||||
|
||||
/* _____________ CRUD _____________ */
|
||||
@@ -62,7 +62,7 @@ export var commentReducer = (state: CommentState = new CommentState(), action: I
|
||||
}
|
||||
}
|
||||
case CommentActionType.DELETE_COMMENT:
|
||||
var parsedComments = {}
|
||||
let parsedComments = {}
|
||||
if (!state.postComments![payload.postId]) {
|
||||
return state
|
||||
}
|
||||
@@ -111,11 +111,11 @@ export var commentReducer = (state: CommentState = new CommentState(), action: I
|
||||
}
|
||||
|
||||
case CommentActionType.CLEAR_ALL_DATA_COMMENT:
|
||||
return new CommentState();
|
||||
return new CommentState()
|
||||
|
||||
|
||||
default:
|
||||
return state;
|
||||
return state
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { commentReducer } from "./commentReducer";
|
||||
import { commentReducer } from './commentReducer'
|
||||
|
||||
export {commentReducer};
|
||||
export {commentReducer}
|
||||
@@ -17,8 +17,8 @@ export class GlobalState {
|
||||
* @memberof IGlobalState
|
||||
*/
|
||||
progress: {
|
||||
percent: number;
|
||||
visible: Boolean;
|
||||
percent: number
|
||||
visible: Boolean
|
||||
} = {
|
||||
percent : 0,
|
||||
visible : false
|
||||
@@ -30,7 +30,7 @@ export class GlobalState {
|
||||
* @type {Boolean}
|
||||
* @memberof IGlobalState
|
||||
*/
|
||||
loadingStatus: Boolean = true;
|
||||
loadingStatus: Boolean = true
|
||||
|
||||
/**
|
||||
* If user date is loaded {true} or not {false}
|
||||
@@ -38,7 +38,7 @@ export class GlobalState {
|
||||
* @type {Boolean}
|
||||
* @memberof IGlobalState
|
||||
*/
|
||||
defaultLoadDataStatus: Boolean = false;
|
||||
defaultLoadDataStatus: Boolean = false
|
||||
|
||||
/**
|
||||
* If message popup is open {true} or not {false}
|
||||
@@ -46,7 +46,7 @@ export class GlobalState {
|
||||
* @type {Boolean}
|
||||
* @memberof IGlobalState
|
||||
*/
|
||||
messageOpen: Boolean = false;
|
||||
messageOpen: Boolean = false
|
||||
|
||||
/**
|
||||
* The text of popup global message
|
||||
@@ -54,7 +54,7 @@ export class GlobalState {
|
||||
* @type {string}
|
||||
* @memberof IGlobalState
|
||||
*/
|
||||
message: string = '';
|
||||
message: string = ''
|
||||
|
||||
/**
|
||||
* Window size
|
||||
@@ -62,7 +62,7 @@ export class GlobalState {
|
||||
* @type {number}
|
||||
* @memberof IGlobalState
|
||||
*/
|
||||
windowWidth: number = 0;
|
||||
windowWidth: number = 0
|
||||
|
||||
/**
|
||||
* Window height
|
||||
@@ -70,7 +70,7 @@ export class GlobalState {
|
||||
* @type {number}
|
||||
* @memberof IGlobalState
|
||||
*/
|
||||
windowHeight: number = 0;
|
||||
windowHeight: number = 0
|
||||
|
||||
/**
|
||||
* The text of website header
|
||||
@@ -78,7 +78,7 @@ export class GlobalState {
|
||||
* @type {string}
|
||||
* @memberof IGlobalState
|
||||
*/
|
||||
headerTitle: string = '';
|
||||
headerTitle: string = ''
|
||||
|
||||
/**
|
||||
* Top loading is visible {true} or not {false}
|
||||
@@ -86,7 +86,7 @@ export class GlobalState {
|
||||
* @type {Boolean}
|
||||
* @memberof IGlobalState
|
||||
*/
|
||||
showTopLoading: Boolean = false;
|
||||
showTopLoading: Boolean = false
|
||||
|
||||
/**
|
||||
* Top loading message queue
|
||||
@@ -94,7 +94,7 @@ export class GlobalState {
|
||||
* @type {number}
|
||||
* @memberof IGlobalState
|
||||
*/
|
||||
topLoadingQueue: number = 0;
|
||||
topLoadingQueue: number = 0
|
||||
|
||||
/**
|
||||
* Temp date storage
|
||||
@@ -102,6 +102,6 @@ export class GlobalState {
|
||||
* @type {*}
|
||||
* @memberof IGlobalState
|
||||
*/
|
||||
temp: any = {};
|
||||
temp: any = {}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GlobalActionType } from 'constants/globalActionType';
|
||||
import { GlobalActionType } from 'constants/globalActionType'
|
||||
|
||||
/**
|
||||
* Global action interface
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// - Import action types
|
||||
import { GlobalActionType } from 'constants/globalActionType';
|
||||
import { GlobalActionType } from 'constants/globalActionType'
|
||||
|
||||
|
||||
import { GlobalState } from "./GlobalState";
|
||||
import { IGlobalAction } from "./IGlobalAction";
|
||||
import { GlobalState } from './GlobalState'
|
||||
import { IGlobalAction } from './IGlobalAction'
|
||||
|
||||
|
||||
/**
|
||||
@@ -48,13 +48,13 @@ export const globalReducer = (state: GlobalState = new GlobalState(), action: IG
|
||||
case GlobalActionType.SHOW_SEND_REQUEST_MESSAGE_GLOBAL:
|
||||
return {
|
||||
...state,
|
||||
message: "Request has been sent",
|
||||
message: 'Request has been sent',
|
||||
messageOpen: true
|
||||
}
|
||||
case GlobalActionType.SHOW_REQUEST_SUCCESS_MESSAGE_GLOBAL:
|
||||
return {
|
||||
...state,
|
||||
message: "Your request has processed successfuly",
|
||||
message: 'Your request has processed successfuly',
|
||||
messageOpen: true
|
||||
}
|
||||
case GlobalActionType.HIDE_MESSAGE_GLOBAL:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { globalReducer } from "./globalReducer";
|
||||
import { globalReducer } from './globalReducer'
|
||||
|
||||
export {globalReducer};
|
||||
export {globalReducer}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Image } from "domain/imageGallery";
|
||||
import { Image } from 'domain/imageGallery'
|
||||
|
||||
/**
|
||||
* ImageGallery state
|
||||
@@ -14,7 +14,7 @@ export class ImageGalleryState {
|
||||
* @type {Boolean}
|
||||
* @memberof ImageGalleryState
|
||||
*/
|
||||
status: Boolean = false;
|
||||
status: Boolean = false
|
||||
|
||||
/**
|
||||
* The list of image
|
||||
@@ -22,7 +22,7 @@ export class ImageGalleryState {
|
||||
* @type {(Image[] | null)}
|
||||
* @memberof ImageGalleryState
|
||||
*/
|
||||
images: Image[] = [];
|
||||
images: Image[] = []
|
||||
|
||||
/**
|
||||
* Selected image name
|
||||
@@ -30,7 +30,7 @@ export class ImageGalleryState {
|
||||
* @type {string}
|
||||
* @memberof ImageGalleryState
|
||||
*/
|
||||
selectImage: string = '';
|
||||
selectImage: string = ''
|
||||
|
||||
/**
|
||||
* Selected image address
|
||||
@@ -38,7 +38,7 @@ export class ImageGalleryState {
|
||||
* @type {string}
|
||||
* @memberof ImageGalleryState
|
||||
*/
|
||||
selectURL: string = '';
|
||||
selectURL: string = ''
|
||||
|
||||
/**
|
||||
* If image gallery is loaded {true} or not false
|
||||
@@ -46,7 +46,7 @@ export class ImageGalleryState {
|
||||
* @type {Boolean}
|
||||
* @memberof ImageGalleryState
|
||||
*/
|
||||
loaded: Boolean = false;
|
||||
loaded: Boolean = false
|
||||
|
||||
/**
|
||||
* Images address list
|
||||
@@ -54,7 +54,7 @@ export class ImageGalleryState {
|
||||
* @type {*}
|
||||
* @memberof ImageGalleryState
|
||||
*/
|
||||
imageURLList: any = {};
|
||||
imageURLList: any = {}
|
||||
|
||||
/**
|
||||
* Store image requested
|
||||
@@ -62,6 +62,6 @@ export class ImageGalleryState {
|
||||
* @type {*}
|
||||
* @memberof ImageGalleryState
|
||||
*/
|
||||
imageRequests: any = {};
|
||||
imageRequests: any = {}
|
||||
|
||||
}
|
||||
@@ -2,21 +2,21 @@
|
||||
import _ from 'lodash'
|
||||
|
||||
// - Import domain
|
||||
import { User } from "domain/users";
|
||||
import { Image } from "domain/imageGallery";
|
||||
import { User } from 'domain/users'
|
||||
import { Image } from 'domain/imageGallery'
|
||||
|
||||
// - Import image gallery action types
|
||||
import {ImageGalleryActionType} from 'constants/imageGalleryActionType'
|
||||
|
||||
|
||||
import { IImageGalleryAction } from "./IImageGalleryAction";
|
||||
import { ImageGalleryState } from "./ImageGalleryState";
|
||||
import { IImageGalleryAction } from './IImageGalleryAction'
|
||||
import { ImageGalleryState } from './ImageGalleryState'
|
||||
|
||||
|
||||
/**
|
||||
* Image gallery reducer
|
||||
*/
|
||||
export var imageGalleryReducer = (state: ImageGalleryState = new ImageGalleryState(), action: IImageGalleryAction) => {
|
||||
export let imageGalleryReducer = (state: ImageGalleryState = new ImageGalleryState(), action: IImageGalleryAction) => {
|
||||
const { payload } = action
|
||||
|
||||
switch (action.type) {
|
||||
@@ -66,6 +66,6 @@ export var imageGalleryReducer = (state: ImageGalleryState = new ImageGallerySta
|
||||
|
||||
|
||||
default:
|
||||
return state;
|
||||
return state
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { imageGalleryReducer } from "./imageGalleryReducer";
|
||||
import { imageGalleryReducer } from './imageGalleryReducer'
|
||||
|
||||
export {imageGalleryReducer};
|
||||
export {imageGalleryReducer}
|
||||
@@ -1,12 +1,12 @@
|
||||
import { authorizeReducer } from "./authorize";
|
||||
import { circleReducer } from "./circles";
|
||||
import { commentReducer } from "./comments";
|
||||
import { globalReducer } from "./global";
|
||||
import { imageGalleryReducer } from "./imageGallery";
|
||||
import { notificationReducer } from "./notifications";
|
||||
import { postReducer } from "./posts";
|
||||
import { userReducer } from "./users";
|
||||
import { voteReducer } from "./votes";
|
||||
import { authorizeReducer } from './authorize'
|
||||
import { circleReducer } from './circles'
|
||||
import { commentReducer } from './comments'
|
||||
import { globalReducer } from './global'
|
||||
import { imageGalleryReducer } from './imageGallery'
|
||||
import { notificationReducer } from './notifications'
|
||||
import { postReducer } from './posts'
|
||||
import { userReducer } from './users'
|
||||
import { voteReducer } from './votes'
|
||||
|
||||
export{
|
||||
authorizeReducer,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Notification } from "domain/notifications";
|
||||
import { Notification } from 'domain/notifications'
|
||||
|
||||
/**
|
||||
* Notification state
|
||||
@@ -14,7 +14,7 @@ export class NotificationState {
|
||||
* @type {({[userId: string]: {[notificationId: string]: Notification}} | null)}
|
||||
* @memberof NotificationState
|
||||
*/
|
||||
userNotifies: {[userId: string]: {[notificationId: string]: Notification}} = {};
|
||||
userNotifies: {[userId: string]: {[notificationId: string]: Notification}} = {}
|
||||
|
||||
/**
|
||||
* If user notifications are loaded {true} or not {false}
|
||||
@@ -22,5 +22,5 @@ export class NotificationState {
|
||||
* @type {Boolean}
|
||||
* @memberof NotificationState
|
||||
*/
|
||||
loaded: Boolean = false;
|
||||
loaded: Boolean = false
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
import { notificationReducer } from "./notificationReducer";
|
||||
import { notificationReducer } from './notificationReducer'
|
||||
|
||||
export {notificationReducer};
|
||||
export {notificationReducer}
|
||||
@@ -3,13 +3,13 @@ import moment from 'moment'
|
||||
import _ from 'lodash'
|
||||
|
||||
// - Import domain
|
||||
import { Notification } from "domain/notifications";
|
||||
import { Notification } from 'domain/notifications'
|
||||
|
||||
// - Import action types
|
||||
import {NotificationActionType} from 'constants/notificationActionType'
|
||||
|
||||
import { NotificationState } from "./NotificationState";
|
||||
import { INotificationAction } from "./INotificationAction";
|
||||
import { NotificationState } from './NotificationState'
|
||||
import { INotificationAction } from './INotificationAction'
|
||||
|
||||
|
||||
/**
|
||||
@@ -17,8 +17,8 @@ import { INotificationAction } from "./INotificationAction";
|
||||
* @param {object} state
|
||||
* @param {object} action
|
||||
*/
|
||||
export var notificationReducer = (state: NotificationState = new NotificationState(), action: INotificationAction) => {
|
||||
var { payload } = action
|
||||
export let notificationReducer = (state: NotificationState = new NotificationState(), action: INotificationAction) => {
|
||||
let { payload } = action
|
||||
switch (action.type) {
|
||||
|
||||
/* _____________ CRUD _____________ */
|
||||
@@ -48,7 +48,7 @@ export var notificationReducer = (state: NotificationState = new NotificationSta
|
||||
}
|
||||
|
||||
case NotificationActionType.DELETE_NOTIFY:
|
||||
var parsedNotifies = {}
|
||||
let parsedNotifies = {}
|
||||
Object.keys(state.userNotifies!).map((id) => {
|
||||
if (id !== payload) {
|
||||
_.merge(parsedNotifies, { [id]: { ...state.userNotifies![id] } })
|
||||
@@ -68,7 +68,7 @@ export var notificationReducer = (state: NotificationState = new NotificationSta
|
||||
|
||||
|
||||
default:
|
||||
return state;
|
||||
return state
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PostActionType } from "constants/postActionType";
|
||||
import { PostActionType } from 'constants/postActionType'
|
||||
|
||||
/**
|
||||
* Post action interface
|
||||
|
||||
@@ -13,7 +13,7 @@ export class PostState {
|
||||
* @type {*}
|
||||
* @memberof PostState
|
||||
*/
|
||||
userPosts: any = {};
|
||||
userPosts: any = {}
|
||||
|
||||
/**
|
||||
* If user posts are loaded {true} or not {false}
|
||||
@@ -21,5 +21,5 @@ export class PostState {
|
||||
* @type {Boolean}
|
||||
* @memberof PostState
|
||||
*/
|
||||
loaded: Boolean = false;
|
||||
loaded: Boolean = false
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
import { postReducer } from "./postReducer";
|
||||
import { postReducer } from './postReducer'
|
||||
|
||||
export {postReducer};
|
||||
export {postReducer}
|
||||
@@ -1,15 +1,15 @@
|
||||
// - Import react components
|
||||
import moment from 'moment'
|
||||
import _ from 'lodash'
|
||||
import {Reducer, Action} from "redux";
|
||||
import {Reducer, Action} from 'redux'
|
||||
|
||||
|
||||
// - Import action types
|
||||
import { PostActionType } from "constants/postActionType";
|
||||
import { PostActionType } from 'constants/postActionType'
|
||||
|
||||
|
||||
import { PostState } from "./PostState";
|
||||
import { IPostAction } from "./IPostAction";
|
||||
import { PostState } from './PostState'
|
||||
import { IPostAction } from './IPostAction'
|
||||
|
||||
|
||||
/**
|
||||
@@ -17,8 +17,8 @@ import { IPostAction } from "./IPostAction";
|
||||
* @param {object} state
|
||||
* @param {object} action
|
||||
*/
|
||||
export var postReducer = (state : PostState = new PostState(), action : IPostAction) => {
|
||||
const { payload } = action;
|
||||
export let postReducer = (state : PostState = new PostState(), action : IPostAction) => {
|
||||
const { payload } = action
|
||||
switch (action.type) {
|
||||
case PostActionType.CLEAR_ALL_DATA_POST:
|
||||
return new PostState()
|
||||
@@ -93,7 +93,7 @@ export var postReducer = (state : PostState = new PostState(), action : IPostAct
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
return state
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { User,Profile } from "domain/users";
|
||||
import { User,Profile } from 'domain/users'
|
||||
|
||||
/**
|
||||
* User state
|
||||
@@ -13,7 +13,7 @@ export class UserState {
|
||||
* @type {({[userId: string]: Profile} | null)}
|
||||
* @memberof UserState
|
||||
*/
|
||||
info: {[userId: string]: Profile} = {};
|
||||
info: {[userId: string]: Profile} = {}
|
||||
|
||||
/**
|
||||
* If users profile are loaded
|
||||
@@ -21,7 +21,7 @@ export class UserState {
|
||||
* @type {Boolean}
|
||||
* @memberof UserState
|
||||
*/
|
||||
loaded: Boolean = false;
|
||||
loaded: Boolean = false
|
||||
|
||||
/**
|
||||
* If edit profile is open {true} or not {false}
|
||||
@@ -29,5 +29,5 @@ export class UserState {
|
||||
* @type {Boolean}
|
||||
* @memberof UserState
|
||||
*/
|
||||
openEditProfile: Boolean = false;
|
||||
openEditProfile: Boolean = false
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
import { userReducer } from "./userReducer";
|
||||
import { userReducer } from './userReducer'
|
||||
|
||||
export {userReducer};
|
||||
export {userReducer}
|
||||
@@ -2,15 +2,15 @@
|
||||
import {UserActionType} from 'constants/userActionType'
|
||||
|
||||
// - Import domain
|
||||
import { User,Profile } from "domain/users";
|
||||
import { User,Profile } from 'domain/users'
|
||||
|
||||
import { UserState } from "./UserState";
|
||||
import { IUserAction } from "./IUserAction";
|
||||
import { UserState } from './UserState'
|
||||
import { IUserAction } from './IUserAction'
|
||||
|
||||
/**
|
||||
* User reducer
|
||||
*/
|
||||
export var userReducer = (state: UserState = new UserState(), action: IUserAction) => {
|
||||
export let userReducer = (state: UserState = new UserState(), action: IUserAction) => {
|
||||
const { payload } = action
|
||||
switch (action.type) {
|
||||
case UserActionType.USER_INFO:
|
||||
@@ -57,7 +57,7 @@ export var userReducer = (state: UserState = new UserState(), action: IUserActio
|
||||
|
||||
|
||||
case UserActionType.CLEAR_ALL_DATA_USER:
|
||||
return new UserState();
|
||||
return new UserState()
|
||||
|
||||
case UserActionType.CLOSE_EDIT_PROFILE:
|
||||
return {
|
||||
@@ -73,6 +73,6 @@ export var userReducer = (state: UserState = new UserState(), action: IUserActio
|
||||
|
||||
|
||||
default:
|
||||
return state;
|
||||
return state
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Vote } from "domain/votes";
|
||||
import { Vote } from 'domain/votes'
|
||||
|
||||
/**
|
||||
* Vote state
|
||||
@@ -14,7 +14,7 @@ export class VoteState {
|
||||
* @type {({[postId: string]: {[voteId: string]: Vote}} | null)}
|
||||
* @memberof VoteState
|
||||
*/
|
||||
postVotes: {[postId: string]: {[voteId: string]: Vote}} | null = null;
|
||||
postVotes: {[postId: string]: {[voteId: string]: Vote}} | null = null
|
||||
|
||||
/**
|
||||
* If posts vote are loaded {true} or not {false}
|
||||
@@ -22,5 +22,5 @@ export class VoteState {
|
||||
* @type {Boolean}
|
||||
* @memberof VoteState
|
||||
*/
|
||||
loaded: Boolean = false;
|
||||
loaded: Boolean = false
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
import { voteReducer } from "./voteReducer";
|
||||
import { voteReducer } from './voteReducer'
|
||||
|
||||
export {voteReducer};
|
||||
export {voteReducer}
|
||||
@@ -6,11 +6,11 @@ import _ from 'lodash'
|
||||
import {VoteActionType} from 'constants/voteActionType'
|
||||
|
||||
// Import domain
|
||||
import { Vote } from "domain/votes";
|
||||
import { Vote } from 'domain/votes'
|
||||
|
||||
|
||||
import { VoteState } from "./VoteState";
|
||||
import { IVoteAction } from "./IVoteAction";
|
||||
import { VoteState } from './VoteState'
|
||||
import { IVoteAction } from './IVoteAction'
|
||||
|
||||
|
||||
/**
|
||||
@@ -18,8 +18,8 @@ import { IVoteAction } from "./IVoteAction";
|
||||
* @param {object} state
|
||||
* @param {object} action
|
||||
*/
|
||||
export var voteReducer = (state: VoteState = new VoteState(), action: IVoteAction) => {
|
||||
var { payload } = action
|
||||
export let voteReducer = (state: VoteState = new VoteState(), action: IVoteAction) => {
|
||||
let { payload } = action
|
||||
switch (action.type) {
|
||||
|
||||
/* _____________ CRUD _____________ */
|
||||
@@ -47,7 +47,7 @@ export var voteReducer = (state: VoteState = new VoteState(), action: IVoteActio
|
||||
}
|
||||
|
||||
case VoteActionType.DELETE_VOTE:
|
||||
var parsedVotes = {}
|
||||
let parsedVotes = {}
|
||||
if (state.postVotes![payload.postId])
|
||||
Object.keys(state.postVotes![payload.postId]).map((id) => {
|
||||
if (id !== payload.id) {
|
||||
@@ -67,11 +67,11 @@ export var voteReducer = (state: VoteState = new VoteState(), action: IVoteActio
|
||||
|
||||
|
||||
case VoteActionType.CLEAR_ALL_DATA_VOTE:
|
||||
return new VoteState();
|
||||
return new VoteState()
|
||||
|
||||
|
||||
default:
|
||||
return state;
|
||||
return state
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user