Improvment in tslint standard (#16)
This commit is contained in:
@@ -1,148 +1,141 @@
|
||||
// - Import react components
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/';
|
||||
import moment from 'moment';
|
||||
import { push } from 'react-router-redux';
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/'
|
||||
import moment from 'moment'
|
||||
import { push } from 'react-router-redux'
|
||||
|
||||
// -Import domain
|
||||
import { User } from 'domain/users';
|
||||
import { SocialError } from "domain/common";
|
||||
|
||||
import { User } from 'domain/users'
|
||||
import { SocialError } from 'domain/common'
|
||||
|
||||
// - Import action types
|
||||
import { AuthorizeActionType } from 'constants/authorizeActionType';
|
||||
import { AuthorizeActionType } from 'constants/authorizeActionType'
|
||||
|
||||
// - Import services
|
||||
import { IAuthorizeService } from "services/authorize";
|
||||
import { IServiceProvider } from "factories";
|
||||
import { ServiceProvide } from "factories";
|
||||
import { IAuthorizeService } from 'services/authorize'
|
||||
import { IServiceProvider } from 'factories'
|
||||
import { ServiceProvide } from 'factories'
|
||||
|
||||
const serviceProvider: IServiceProvider = new ServiceProvide();
|
||||
const authorizeService: IAuthorizeService = serviceProvider.createAuthorizeService();
|
||||
const serviceProvider: IServiceProvider = new ServiceProvide()
|
||||
const authorizeService: IAuthorizeService = serviceProvider.createAuthorizeService()
|
||||
|
||||
// - Import actions
|
||||
import * as globalActions from 'actions/globalActions';
|
||||
|
||||
import * as globalActions from 'actions/globalActions'
|
||||
|
||||
/* _____________ CRUD DB _____________ */
|
||||
|
||||
|
||||
/**
|
||||
* Log in user in server
|
||||
* @param {string} email
|
||||
* @param {string} password
|
||||
* @param {string} email
|
||||
* @param {string} password
|
||||
*/
|
||||
export const dbLogin = (email: string, password: string) => {
|
||||
return (dispatch: any, getState: any) => {
|
||||
dispatch(globalActions.showNotificationRequest())
|
||||
|
||||
return authorizeService.login(email, password).then((result) => {
|
||||
dispatch(globalActions.showNotificationSuccess())
|
||||
dispatch(login(result.uid))
|
||||
dispatch(push('/'))
|
||||
}, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code)))
|
||||
}
|
||||
export const dbLogin = (email: string, password: string) => {
|
||||
return (dispatch: any, getState: any) => {
|
||||
dispatch(globalActions.showNotificationRequest())
|
||||
return authorizeService.login(email, password).then((result) => {
|
||||
dispatch(globalActions.showNotificationSuccess())
|
||||
dispatch(login(result.uid))
|
||||
dispatch(push('/'))
|
||||
}, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code)))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out user in server
|
||||
*/
|
||||
export const dbLogout = () => {
|
||||
return (dispatch: any, getState: any) => {
|
||||
return authorizeService.logout().then((result) => {
|
||||
dispatch(logout());
|
||||
dispatch(push('/login'));
|
||||
|
||||
}, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code)))
|
||||
}
|
||||
export const dbLogout = () => {
|
||||
return (dispatch: any, getState: any) => {
|
||||
return authorizeService.logout().then((result) => {
|
||||
dispatch(logout())
|
||||
dispatch(push('/login'))
|
||||
|
||||
}, (error: SocialError) => dispatch(globalActions.showErrorMessage(error.code)))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param user for registering
|
||||
*/
|
||||
export const dbSignup = (user: User) => {
|
||||
return (dispatch: any, getState: any) => {
|
||||
dispatch(globalActions.showNotificationRequest())
|
||||
return authorizeService.registerUser(user).then((result) => {
|
||||
dispatch(signup({
|
||||
userId: result.uid,
|
||||
...user
|
||||
}))
|
||||
dispatch(push('/'))
|
||||
})
|
||||
.catch((error: SocialError) => dispatch(globalActions.showErrorMessage(error.code)));
|
||||
}
|
||||
|
||||
export const dbSignup = (user: User) => {
|
||||
return (dispatch: any, getState: any) => {
|
||||
dispatch(globalActions.showNotificationRequest())
|
||||
return authorizeService.registerUser(user).then((result) => {
|
||||
dispatch(signup({
|
||||
userId: result.uid,
|
||||
...user
|
||||
}))
|
||||
dispatch(push('/'))
|
||||
})
|
||||
.catch((error: SocialError) => dispatch(globalActions.showErrorMessage(error.code)))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Change user's password
|
||||
* @param {string} newPassword
|
||||
* @param {string} newPassword
|
||||
*/
|
||||
export const dbUpdatePassword = (newPassword: string) => {
|
||||
return (dispatch: any, getState: any) => {
|
||||
dispatch(globalActions.showNotificationRequest())
|
||||
|
||||
return authorizeService.updatePassword(newPassword).then(() => {
|
||||
|
||||
export const dbUpdatePassword = (newPassword: string) => {
|
||||
return (dispatch: any, getState: any) => {
|
||||
dispatch(globalActions.showNotificationRequest())
|
||||
|
||||
return authorizeService.updatePassword(newPassword).then(() => {
|
||||
|
||||
// Update successful.
|
||||
dispatch(globalActions.showNotificationSuccess())
|
||||
dispatch(updatePassword())
|
||||
dispatch(push('/'))
|
||||
})
|
||||
dispatch(globalActions.showNotificationSuccess())
|
||||
dispatch(updatePassword())
|
||||
dispatch(push('/'))
|
||||
})
|
||||
.catch((error: SocialError) => {
|
||||
// An error happened.
|
||||
switch (error.code) {
|
||||
case 'auth/requires-recent-login':
|
||||
dispatch(globalActions.showErrorMessage(error.code))
|
||||
dispatch(dbLogout())
|
||||
break;
|
||||
break
|
||||
default:
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* _____________ CRUD State _____________ */
|
||||
|
||||
/**
|
||||
* Loing user
|
||||
* @param {string} uid
|
||||
* @param {string} uids
|
||||
*/
|
||||
export const login = (uid: string) => {
|
||||
return {
|
||||
type: AuthorizeActionType.LOGIN,
|
||||
payload: { authed: true, uid }
|
||||
}
|
||||
export const login = (uid: string) => {
|
||||
return {
|
||||
type: AuthorizeActionType.LOGIN,
|
||||
payload: { authed: true, uid }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout user
|
||||
*/
|
||||
export const logout = () => {
|
||||
return { type: AuthorizeActionType.LOGOUT }
|
||||
}
|
||||
export const logout = () => {
|
||||
return { type: AuthorizeActionType.LOGOUT }
|
||||
}
|
||||
|
||||
/**
|
||||
* User registeration call
|
||||
* @param user for registering
|
||||
*/
|
||||
export const signup = (user: User) => {
|
||||
return {
|
||||
type: AuthorizeActionType.SIGNUP,
|
||||
payload: { ...user }
|
||||
}
|
||||
|
||||
export const signup = (user: User) => {
|
||||
return {
|
||||
type: AuthorizeActionType.SIGNUP,
|
||||
payload: { ...user }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update user's password
|
||||
*/
|
||||
export const updatePassword = () => {
|
||||
return { type: AuthorizeActionType.UPDATE_PASSWORD }
|
||||
}
|
||||
|
||||
export const updatePassword = () => {
|
||||
return { type: AuthorizeActionType.UPDATE_PASSWORD }
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import firebase, { firebaseRef } from 'app/firebase/'
|
||||
|
||||
// - Import domain
|
||||
import { User } from "domain/users";
|
||||
import { Circle, UserFollower } from "domain/circles";
|
||||
import { User } from 'domain/users'
|
||||
import { Circle, UserFollower } from 'domain/circles'
|
||||
|
||||
// - Import utility components
|
||||
import moment from 'moment'
|
||||
@@ -29,7 +29,7 @@ import * as notifyActions from 'actions/notifyActions'
|
||||
* Add a circle
|
||||
* @param {string} circleName
|
||||
*/
|
||||
export var dbAddCircle = (circleName: string) => {
|
||||
export let dbAddCircle = (circleName: string) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
let uid: string = getState().authorize.uid
|
||||
@@ -41,7 +41,7 @@ export var dbAddCircle = (circleName: string) => {
|
||||
|
||||
let circleRef = firebaseRef.child(`userCircles/${uid}/circles`).push(circle)
|
||||
return circleRef.then(() => {
|
||||
circle.id = circleRef.key;
|
||||
circle.id = circleRef.key
|
||||
circle.ownerId = uid
|
||||
dispatch(addCircle(circle))
|
||||
|
||||
@@ -55,11 +55,11 @@ export var dbAddCircle = (circleName: string) => {
|
||||
* @param {string} cid is circle identifier
|
||||
* @param {User} userFollowing is the user for following
|
||||
*/
|
||||
export var dbAddFollowingUser = (cid: string, userFollowing: User) => {
|
||||
export let dbAddFollowingUser = (cid: string, userFollowing: User) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
let uid: string = getState().authorize.uid;
|
||||
let user: User = getState().user.info[uid];
|
||||
let uid: string = getState().authorize.uid
|
||||
let user: User = getState().user.info[uid]
|
||||
|
||||
let userCircle: User = {
|
||||
creationDate: moment().unix(),
|
||||
@@ -99,7 +99,7 @@ export var dbAddFollowingUser = (cid: string, userFollowing: User) => {
|
||||
* @param {string} cid is circle identifier
|
||||
* @param {string} followingId following user identifier
|
||||
*/
|
||||
export var dbDeleteFollowingUser = (cid: string, followingId: string) => {
|
||||
export let dbDeleteFollowingUser = (cid: string, followingId: string) => {
|
||||
return (dispatch: any, getState:Function) => {
|
||||
|
||||
let uid: string = getState().authorize.uid
|
||||
@@ -154,14 +154,14 @@ export const dbDeleteCircle = (id: string) => {
|
||||
let uid: string = getState().authorize.uid
|
||||
|
||||
// Write the new data simultaneously in the list
|
||||
let updates: any = {};
|
||||
updates[`userCircles/${uid}/circles/${id}`] = null;
|
||||
let updates: any = {}
|
||||
updates[`userCircles/${uid}/circles/${id}`] = null
|
||||
|
||||
return firebaseRef.update(updates).then((result) => {
|
||||
dispatch(deleteCircle(uid, id))
|
||||
}, (error) => {
|
||||
dispatch(globalActions.showErrorMessage(error.message))
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -173,16 +173,16 @@ export const dbGetCircles = () => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
let uid: string = getState().authorize.uid
|
||||
if (uid) {
|
||||
let circlesRef: any = firebaseRef.child(`userCircles/${uid}/circles`);
|
||||
let circlesRef: any = firebaseRef.child(`userCircles/${uid}/circles`)
|
||||
|
||||
return circlesRef.once('value').then((snapshot: any) => {
|
||||
var circles: any = snapshot.val() || {};
|
||||
var parsedCircles: { [circleId: string]: Circle } = {};
|
||||
let circles: any = snapshot.val() || {}
|
||||
let parsedCircles: { [circleId: string]: Circle } = {}
|
||||
Object.keys(circles).forEach((circleId) => {
|
||||
if (circleId !== '-Followers' && circles[circleId].users) {
|
||||
Object.keys(circles[circleId].users).filter((v, i, a) => a.indexOf(v) === i).forEach((userId) => {
|
||||
dispatch(postActions.dbGetPostsByUserId(userId))
|
||||
dispatch(userActions.dbGetUserInfoByUserId(userId, ""))
|
||||
dispatch(userActions.dbGetUserInfoByUserId(userId, ''))
|
||||
})
|
||||
}
|
||||
parsedCircles[circleId] = {
|
||||
@@ -191,8 +191,8 @@ export const dbGetCircles = () => {
|
||||
}
|
||||
})
|
||||
|
||||
dispatch(addCircles(uid, parsedCircles));
|
||||
});
|
||||
dispatch(addCircles(uid, parsedCircles))
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
@@ -207,18 +207,18 @@ export const dbGetCirclesByUserId = (uid: string) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
if (uid) {
|
||||
let circlesRef = firebaseRef.child(`userCircles/${uid}/circles`);
|
||||
let circlesRef = firebaseRef.child(`userCircles/${uid}/circles`)
|
||||
|
||||
return circlesRef.once('value').then((snapshot) => {
|
||||
var circles = snapshot.val() || {};
|
||||
var parsedCircles: { [circleId: string]: Circle } = {};
|
||||
let circles = snapshot.val() || {}
|
||||
let parsedCircles: { [circleId: string]: Circle } = {}
|
||||
Object.keys(circles).forEach((circleId) => {
|
||||
parsedCircles[circleId] = {
|
||||
id: circleId,
|
||||
...circles[circleId]
|
||||
}
|
||||
})
|
||||
dispatch(addCircles(uid, parsedCircles));
|
||||
dispatch(addCircles(uid, parsedCircles))
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -3,17 +3,15 @@ import moment from 'moment'
|
||||
import { firebaseRef } from 'app/firebase/'
|
||||
|
||||
// - Import domain
|
||||
import { Comment } from "domain/comments";
|
||||
import { Comment } from 'domain/comments'
|
||||
|
||||
// - Import action types
|
||||
import {CommentActionType} from 'constants/commentActionType'
|
||||
import { CommentActionType } from 'constants/commentActionType'
|
||||
|
||||
// - Import actions
|
||||
import * as globalActions from 'actions/globalActions'
|
||||
import * as notifyActions from 'actions/notifyActions'
|
||||
|
||||
|
||||
|
||||
/* _____________ CRUD DB _____________ */
|
||||
|
||||
/**
|
||||
@@ -38,20 +36,22 @@ export const dbAddComment = (ownerPostUserId: string,newComment: Comment, callBa
|
||||
postId: newComment.postId,
|
||||
text: newComment.text
|
||||
}
|
||||
|
||||
|
||||
let commentRef: any = firebaseRef.child(`postComments/${newComment.postId}`).push(comment)
|
||||
return commentRef.then(() => {
|
||||
dispatch(addComment(newComment))
|
||||
callBack()
|
||||
dispatch(globalActions.hideTopLoading())
|
||||
|
||||
if (ownerPostUserId && ownerPostUserId !== uid)
|
||||
if (ownerPostUserId && ownerPostUserId !== uid) {
|
||||
dispatch(notifyActions.dbAddNotify(
|
||||
{
|
||||
description: 'Add comment on your post.',
|
||||
url: `/${ownerPostUserId}/posts/${newComment.postId}`,
|
||||
notifyRecieverUserId: ownerPostUserId, notifierUserId: uid
|
||||
notifyRecieverUserId: ownerPostUserId, notifierUserId: uid,
|
||||
isSeen: false
|
||||
}))
|
||||
}
|
||||
|
||||
}, (error: any) => {
|
||||
dispatch(globalActions.showErrorMessage(error.message))
|
||||
@@ -69,10 +69,10 @@ export const dbGetComments = () => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
let uid: string = getState().authorize.uid
|
||||
if (uid) {
|
||||
let commentsRef: any = firebaseRef.child(`postComments`);
|
||||
let commentsRef: any = firebaseRef.child(`postComments`)
|
||||
|
||||
return commentsRef.on('value', (snapshot: any) => {
|
||||
let comments: {[postId: string]: {[commentId: string] : Comment}} = snapshot!.val() || {};
|
||||
let comments: {[postId: string]: {[commentId: string]: Comment}} = snapshot!.val() || {}
|
||||
dispatch(addCommentList(comments))
|
||||
|
||||
})
|
||||
@@ -92,12 +92,11 @@ export const dbUpdateComment = (id: string, postId: string, text: string) => {
|
||||
|
||||
dispatch(globalActions.showTopLoading())
|
||||
|
||||
|
||||
// Get current user id
|
||||
let uid: string = getState().authorize.uid
|
||||
|
||||
// Write the new data simultaneously in the list
|
||||
let updates: any = {};
|
||||
let updates: any = {}
|
||||
let comment: Comment = getState().comment.postComments[postId][id]
|
||||
updates[`postComments/${postId}/${id}`] = {
|
||||
postId: postId,
|
||||
@@ -131,13 +130,12 @@ export const dbDeleteComment = (id: string, postId: string) => {
|
||||
|
||||
dispatch(globalActions.showTopLoading())
|
||||
|
||||
|
||||
// Get current user id
|
||||
let uid: string = getState().authorize.uid
|
||||
|
||||
// Write the new data simultaneously in the list
|
||||
let updates: any = {};
|
||||
updates[`postComments/${postId}/${id}`] = null;
|
||||
let updates: any = {}
|
||||
updates[`postComments/${postId}/${id}`] = null
|
||||
|
||||
return firebaseRef.update(updates).then((result) => {
|
||||
dispatch(deleteComment(id, postId))
|
||||
@@ -154,12 +152,11 @@ export const dbDeleteComment = (id: string, postId: string) => {
|
||||
|
||||
/* _____________ CRUD State _____________ */
|
||||
|
||||
|
||||
/**
|
||||
* Add comment
|
||||
* @param {Comment} data
|
||||
* Add comment
|
||||
* @param {Comment} data
|
||||
*/
|
||||
export const addComment = (comment:Comment) => {
|
||||
export const addComment = (comment: Comment) => {
|
||||
|
||||
return {
|
||||
type: CommentActionType.ADD_COMMENT,
|
||||
@@ -168,7 +165,7 @@ export const addComment = (comment:Comment) => {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param id comment identifier
|
||||
* @param postId post identefier which comment belong to
|
||||
* @param text the new text for comment
|
||||
@@ -185,7 +182,7 @@ export const updateComment = ( id: string, postId: string, text: string) => {
|
||||
* Add comment list
|
||||
* @param {[postId: string]: {[commentId: string] : Comment}} postComments an array of comments
|
||||
*/
|
||||
export const addCommentList = (postComments: {[postId: string]: {[commentId: string] : Comment}}) => {
|
||||
export const addCommentList = (postComments: {[postId: string]: {[commentId: string]: Comment}}) => {
|
||||
|
||||
return {
|
||||
type: CommentActionType.ADD_COMMENT_LIST,
|
||||
@@ -193,8 +190,6 @@ export const addCommentList = (postComments: {[postId: string]: {[commentId: str
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Delete a comment
|
||||
* @param {string} id of comment
|
||||
@@ -229,4 +224,3 @@ export const closeCommentEditor = (comment: Comment) => {
|
||||
payload: comment
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,10 +84,10 @@ export const setHeaderTitleOpt = (callerKey: string,payload: any) => {
|
||||
case 'profile':
|
||||
const userName = getState().user.info && getState().user.info[payload] ? getState().user.info[payload].fullName : ''
|
||||
dispatch(setHeaderTitle(userName))
|
||||
break;
|
||||
break
|
||||
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ import moment from 'moment'
|
||||
import { firebaseRef, firebaseAuth, storageRef } from 'app/firebase/'
|
||||
|
||||
// - Import domain
|
||||
import { Image } from "domain/imageGallery";
|
||||
import { Image } from 'domain/imageGallery'
|
||||
|
||||
// - Import action types
|
||||
import {ImageGalleryActionType} from 'constants/imageGalleryActionType'
|
||||
import { ImageGalleryActionType } from 'constants/imageGalleryActionType'
|
||||
|
||||
// - Import actions
|
||||
import * as globalActions from 'actions/globalActions'
|
||||
@@ -16,8 +16,6 @@ import FileAPI from 'api/FileAPI'
|
||||
|
||||
/* _____________ UI Actions _____________ */
|
||||
|
||||
declare const console: any;
|
||||
|
||||
/**
|
||||
* Download images for image gallery
|
||||
*/
|
||||
@@ -25,18 +23,18 @@ export const downloadForImageGallery = () => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
let uid: string = getState().authorize.uid
|
||||
if (uid) {
|
||||
let imagesRef: any = firebaseRef.child(`userFiles/${uid}/files/images`);
|
||||
let imagesRef: any = firebaseRef.child(`userFiles/${uid}/files/images`)
|
||||
|
||||
return imagesRef.once('value').then((snapshot: any) => {
|
||||
var images = snapshot.val() || {};
|
||||
var parsedImages: Image[] = []
|
||||
let images = snapshot.val() || {}
|
||||
let parsedImages: Image[] = []
|
||||
Object.keys(images).forEach((imageId) => {
|
||||
parsedImages.push({
|
||||
id: imageId,
|
||||
...images[imageId]
|
||||
})
|
||||
})
|
||||
dispatch(addImageList(parsedImages));
|
||||
dispatch(addImageList(parsedImages))
|
||||
})
|
||||
|
||||
}
|
||||
@@ -55,17 +53,17 @@ export const dbSaveImage = (imageURL: string,imageFullPath: string) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
let uid: string = getState().authorize.uid
|
||||
var image: Image = {
|
||||
let image: Image = {
|
||||
creationDate: moment().unix(),
|
||||
deleteDate: '',
|
||||
URL: imageURL,
|
||||
fullPath:imageFullPath,
|
||||
fullPath: imageFullPath,
|
||||
ownerUserId: uid,
|
||||
lastEditDate: 0,
|
||||
deleted: false
|
||||
}
|
||||
|
||||
var imageRef = firebaseRef.child(`userFiles/${uid}/files/images`).push(image)
|
||||
let imageRef = firebaseRef.child(`userFiles/${uid}/files/images`).push(image)
|
||||
return imageRef.then(() => {
|
||||
dispatch(addImage({
|
||||
...image,
|
||||
@@ -84,26 +82,26 @@ export const dbDeleteImage = (id: string) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
// Get current user id
|
||||
let uid: string = getState().authorize.uid;
|
||||
let uid: string = getState().authorize.uid
|
||||
|
||||
// Write the new data simultaneously in the list
|
||||
var updates: any = {};
|
||||
updates[`userFiles/${uid}/files/images/${id}`] = null;
|
||||
let updates: any = {}
|
||||
updates[`userFiles/${uid}/files/images/${id}`] = null
|
||||
|
||||
return firebaseRef.update(updates).then((result) => {
|
||||
dispatch(deleteImage(id))
|
||||
console.log('image removed: ', id);
|
||||
console.log('image removed: ', id)
|
||||
}, (error) => {
|
||||
console.log(error);
|
||||
});
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload image on the server
|
||||
* @param {file} file
|
||||
* @param {string} fileName
|
||||
* @param {file} file
|
||||
* @param {string} fileName
|
||||
*/
|
||||
export const dbUploadImage = (file: any, fileName: string) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
@@ -116,48 +114,49 @@ export const dbUploadImage = (file: any, fileName: string) => {
|
||||
|
||||
// Upload storage bar
|
||||
task.on('state_changed', (snapshot: any) => {
|
||||
var percentage = (snapshot.bytesTransferred / snapshot.totalBytes) * 100
|
||||
let percentage = (snapshot.bytesTransferred / snapshot.totalBytes) * 100
|
||||
dispatch(globalActions.progressChange(percentage, true))
|
||||
|
||||
|
||||
}, (error: any) => {
|
||||
dispatch(globalActions.showErrorMessage(error.code))
|
||||
dispatch(globalActions.hideTopLoading())
|
||||
|
||||
}, (complete?: any ) => {
|
||||
}, (complete?: any ) => {
|
||||
dispatch(globalActions.progressChange(100, false))
|
||||
dispatch(dbSaveImage(fileName,''))
|
||||
dispatch(globalActions.hideTopLoading())
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Download image from server
|
||||
* @param {string} fileName
|
||||
* @param {string} fileName
|
||||
*/
|
||||
export const dbDownloadImage = (fileName: string) => {
|
||||
|
||||
return (dispatch: any, getState: Function) => {
|
||||
if (fileName == 'noImage')
|
||||
if (fileName === 'noImage') {
|
||||
return {}
|
||||
if (getState().imageGallery.imageURLList[fileName] && fileName !== '')
|
||||
}
|
||||
if (getState().imageGallery.imageURLList[fileName] && fileName !== '') {
|
||||
return
|
||||
|
||||
if (getState().imageGallery.imageRequests.indexOf(fileName) > -1)
|
||||
}
|
||||
if (getState().imageGallery.imageRequests.indexOf(fileName) > -1){
|
||||
return
|
||||
}
|
||||
dispatch(sendImageRequest(fileName))
|
||||
|
||||
// Create a reference to the file we want to download
|
||||
let starsRef: any = storageRef.child(`images/${fileName}`);
|
||||
// Create a reference to the file we want to download
|
||||
let starsRef: any = storageRef.child(`images/${fileName}`)
|
||||
|
||||
// Get the download URL
|
||||
starsRef.getDownloadURL().then((url: string) => {
|
||||
// Insert url into an <img> tag to "download"
|
||||
// Insert url into an <img> tag to 'download'
|
||||
if (!getState().imageGallery.imageURLList[fileName] || fileName === '')
|
||||
dispatch(setImageURL(fileName, url))
|
||||
}).catch((error:any) => {
|
||||
}).catch((error: any) => {
|
||||
|
||||
// A full list of error codes is available at
|
||||
// https://firebase.google.com/docs/storage/web/handle-errors
|
||||
@@ -165,24 +164,24 @@ export const dbDownloadImage = (fileName: string) => {
|
||||
case 'storage/object_not_found':
|
||||
// File doesn't exist
|
||||
dispatch(globalActions.showErrorMessage('storage/object_not_found'))
|
||||
break;
|
||||
break
|
||||
|
||||
case 'storage/unauthorized':
|
||||
// User doesn't have permission to access the object
|
||||
dispatch(globalActions.showErrorMessage('storage/unauthorized'))
|
||||
break;
|
||||
break
|
||||
|
||||
case 'storage/canceled':
|
||||
// User canceled the upload
|
||||
dispatch(globalActions.showErrorMessage('storage/canceled'))
|
||||
break;
|
||||
break
|
||||
|
||||
case 'storage/unknown':
|
||||
// Unknown error occurred, inspect the server response
|
||||
dispatch(globalActions.showErrorMessage('storage/unknown'))
|
||||
break;
|
||||
break
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import moment from 'moment'
|
||||
import { firebaseRef } from 'app/firebase/'
|
||||
|
||||
// - Import domain
|
||||
import { Notification } from "domain/notifications";
|
||||
import { Notification } from 'domain/notifications'
|
||||
|
||||
// - Import action types
|
||||
import {NotificationActionType} from 'constants/notificationActionType'
|
||||
@@ -47,10 +47,10 @@ export const dbGetNotifies = () => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
let uid: string = getState().authorize.uid
|
||||
if (uid) {
|
||||
let notifiesRef: any = firebaseRef.child(`userNotifies/${uid}`);
|
||||
let notifiesRef: any = firebaseRef.child(`userNotifies/${uid}`)
|
||||
|
||||
return notifiesRef.on('value', (snapshot: any) => {
|
||||
let notifies: {[notifyId: string]: Notification} = snapshot.val() || {};
|
||||
let notifies: {[notifyId: string]: Notification} = snapshot.val() || {}
|
||||
|
||||
Object.keys(notifies).forEach((key => {
|
||||
if (!getState().user.info[notifies[key].notifierUserId]) {
|
||||
@@ -74,11 +74,11 @@ export const dbDeleteNotify = (id: string) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
// Get current user id
|
||||
var uid: string = getState().authorize.uid
|
||||
let uid: string = getState().authorize.uid
|
||||
|
||||
// Write the new data simultaneously in the list
|
||||
var updates: any = {};
|
||||
updates[`userNotifies/${uid}/${id}`] = null;
|
||||
let updates: any = {}
|
||||
updates[`userNotifies/${uid}/${id}`] = null
|
||||
|
||||
return firebaseRef.update(updates).then((result) => {
|
||||
dispatch(deleteNotify(id))
|
||||
@@ -101,7 +101,7 @@ export const dbSeenNotify = (id: string) => {
|
||||
let notify: Notification = getState().notify.userNotifies[id]
|
||||
|
||||
|
||||
let updates: any = {};
|
||||
let updates: any = {}
|
||||
updates[`userNotifies/${uid}/${id}`] = {
|
||||
description: notify.description,
|
||||
url: notify.url,
|
||||
|
||||
@@ -1,35 +1,29 @@
|
||||
// - Import react components
|
||||
import { Action } from "redux";
|
||||
import { Action } from 'redux'
|
||||
|
||||
// - Import firebase component
|
||||
import firebase, { firebaseRef } from '../firebase';
|
||||
import firebase, { firebaseRef } from '../firebase'
|
||||
|
||||
// - Import domain
|
||||
import { Post } from "domain/posts";
|
||||
import { Post } from 'domain/posts'
|
||||
|
||||
// - Import utility components
|
||||
import moment from 'moment';
|
||||
import moment from 'moment'
|
||||
|
||||
// - Import action types
|
||||
import { PostActionType } from 'constants/postActionType';
|
||||
import { PostActionType } from 'constants/postActionType'
|
||||
|
||||
// - Import actions
|
||||
import * as globalActions from 'actions/globalActions';
|
||||
|
||||
declare const console: any;
|
||||
|
||||
|
||||
|
||||
|
||||
import * as globalActions from 'actions/globalActions'
|
||||
|
||||
/* _____________ CRUD DB _____________ */
|
||||
|
||||
/**
|
||||
* Add a normal post
|
||||
* @param {any} newPost
|
||||
* @param {Function} callBack
|
||||
* @param {any} newPost
|
||||
* @param {Function} callBack
|
||||
*/
|
||||
export var dbAddPost = (newPost: any, callBack: Function) => {
|
||||
export let dbAddPost = (newPost: any, callBack: Function) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
let uid: string = getState().authorize.uid
|
||||
@@ -47,14 +41,13 @@ export var dbAddPost = (newPost: any, callBack: Function) => {
|
||||
tags: newPost.tags || [],
|
||||
commentCounter: 0,
|
||||
image: '',
|
||||
imageFullPath:'',
|
||||
imageFullPath: '',
|
||||
video: '',
|
||||
disableComments: newPost.disableComments,
|
||||
disableSharing: newPost.disableSharing,
|
||||
deleted: false
|
||||
}
|
||||
|
||||
|
||||
let postRef: any = firebaseRef.child(`userPosts/${uid}/posts`).push(post)
|
||||
return postRef.then(() => {
|
||||
dispatch(addPost(uid, {
|
||||
@@ -66,11 +59,10 @@ export var dbAddPost = (newPost: any, callBack: Function) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a post with image
|
||||
* @param {object} newPost
|
||||
* @param {function} callBack
|
||||
* @param {object} newPost
|
||||
* @param {function} callBack
|
||||
*/
|
||||
export const dbAddImagePost = (newPost: any, callBack: Function) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
@@ -99,8 +91,7 @@ export const dbAddImagePost = (newPost: any, callBack: Function) => {
|
||||
deleted: false
|
||||
}
|
||||
|
||||
|
||||
let postRef : any = firebaseRef.child(`userPosts/${uid}/posts`).push(post)
|
||||
let postRef: any = firebaseRef.child(`userPosts/${uid}/posts`).push(post)
|
||||
return postRef.then(() => {
|
||||
dispatch(addPost(uid, {
|
||||
...post,
|
||||
@@ -116,12 +107,12 @@ export const dbAddImagePost = (newPost: any, callBack: Function) => {
|
||||
|
||||
/**
|
||||
* Update a post from database
|
||||
* @param {object} newPost
|
||||
* @param {object} newPost
|
||||
* @param {func} callBack //TODO: anti pattern should change to parent state or move state to redux
|
||||
*/
|
||||
export const dbUpdatePost = (newPost: any, callBack: Function) => {
|
||||
console.log(newPost)
|
||||
return (dispatch : any, getState: Function) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
dispatch(globalActions.showTopLoading())
|
||||
|
||||
@@ -129,7 +120,7 @@ export const dbUpdatePost = (newPost: any, callBack: Function) => {
|
||||
let uid: string = getState().authorize.uid
|
||||
|
||||
// Write the new data simultaneously in the list
|
||||
let updates: any = {};
|
||||
let updates: any = {}
|
||||
let post: Post = getState().post.userPosts[uid][newPost.id]
|
||||
let updatedPost: Post = {
|
||||
postTypeId: post.postTypeId,
|
||||
@@ -172,16 +163,16 @@ export const dbUpdatePost = (newPost: any, callBack: Function) => {
|
||||
* @param {string} id is post identifier
|
||||
*/
|
||||
export const dbDeletePost = (id: string) => {
|
||||
return (dispatch:any, getState:Function) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
dispatch(globalActions.showTopLoading())
|
||||
|
||||
// Get current user id
|
||||
let uid : string = getState().authorize.uid
|
||||
let uid: string = getState().authorize.uid
|
||||
|
||||
// Write the new data simultaneously in the list
|
||||
let updates : any= {};
|
||||
updates[`userPosts/${uid}/posts/${id}`] = null;
|
||||
let updates: any = {}
|
||||
updates[`userPosts/${uid}/posts/${id}`] = null
|
||||
|
||||
return firebaseRef.update(updates).then((result) => {
|
||||
dispatch(deletePost(uid, id))
|
||||
@@ -190,7 +181,7 @@ export const dbDeletePost = (id: string) => {
|
||||
}, (error) => {
|
||||
dispatch(globalActions.showErrorMessage(error.message))
|
||||
dispatch(globalActions.hideTopLoading())
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -199,23 +190,23 @@ export const dbDeletePost = (id: string) => {
|
||||
* Get all user posts from data base
|
||||
*/
|
||||
export const dbGetPosts = () => {
|
||||
return (dispatch:any, getState:any) => {
|
||||
return (dispatch: any, getState: any) => {
|
||||
let uid: string = getState().authorize.uid
|
||||
if (uid) {
|
||||
let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts`);
|
||||
let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts`)
|
||||
|
||||
return postsRef.once('value').then((snapshot: any) => {
|
||||
var posts: any = snapshot.val() || {};
|
||||
var parsedPosts : {[postId: string]: Post} = {};
|
||||
let posts: any = snapshot.val() || {}
|
||||
let parsedPosts: { [postId: string]: Post } = {}
|
||||
Object.keys(posts).forEach((postId) => {
|
||||
parsedPosts[postId] = {
|
||||
id: postId,
|
||||
...posts[postId]
|
||||
};
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
dispatch(addPosts(uid, parsedPosts));
|
||||
});
|
||||
dispatch(addPosts(uid, parsedPosts))
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
@@ -226,19 +217,19 @@ export const dbGetPosts = () => {
|
||||
* @param uid post owner identifier
|
||||
* @param postId post identifier
|
||||
*/
|
||||
export const dbGetPostById = (uid:string, postId:string) => {
|
||||
export const dbGetPostById = (uid: string, postId: string) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
if (uid) {
|
||||
let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts/${postId}`);
|
||||
let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts/${postId}`)
|
||||
|
||||
return postsRef.once('value').then((snapshot: any) => {
|
||||
const newPost = snapshot.val() || {};
|
||||
const newPost = snapshot.val() || {}
|
||||
const post = {
|
||||
id: postId,
|
||||
...newPost
|
||||
}
|
||||
dispatch(addPost(uid, post));
|
||||
});
|
||||
dispatch(addPost(uid, post))
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
@@ -253,30 +244,25 @@ export const dbGetPostsByUserId = (uid: string) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
if (uid) {
|
||||
let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts`);
|
||||
let postsRef: any = firebaseRef.child(`userPosts/${uid}/posts`)
|
||||
|
||||
return postsRef.once('value').then((snapshot: any) => {
|
||||
let posts: any = snapshot.val() || {};
|
||||
let parsedPosts: {[postId: string]: Post} = {};
|
||||
let posts: any = snapshot.val() || {}
|
||||
let parsedPosts: { [postId: string]: Post } = {}
|
||||
Object.keys(posts).forEach((postId) => {
|
||||
parsedPosts[postId] = {
|
||||
id: postId,
|
||||
...posts[postId]
|
||||
};
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
dispatch(addPosts(uid, parsedPosts));
|
||||
});
|
||||
dispatch(addPosts(uid, parsedPosts))
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* _____________ CRUD State _____________ */
|
||||
|
||||
/**
|
||||
@@ -294,7 +280,7 @@ export const addPost = (uid: string, post: Post) => {
|
||||
/**
|
||||
* Update a post
|
||||
* @param {string} uid is user identifier
|
||||
* @param {Post} post
|
||||
* @param {Post} post
|
||||
*/
|
||||
export const updatePost = (uid: string, post: Post) => {
|
||||
return {
|
||||
@@ -315,13 +301,12 @@ export const deletePost = (uid: string, id: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a list of post
|
||||
* @param {string} uid
|
||||
* @param {[object]} posts
|
||||
*/
|
||||
export const addPosts = (uid: string, posts: {[postId: string]: Post}) => {
|
||||
export const addPosts = (uid: string, posts: { [postId: string]: Post }) => {
|
||||
return {
|
||||
type: PostActionType.ADD_LIST_POST,
|
||||
payload: { uid, posts }
|
||||
@@ -339,7 +324,7 @@ export const clearAllData = () => {
|
||||
|
||||
/**
|
||||
* Add a post with image
|
||||
* @param {object} post
|
||||
* @param {object} post
|
||||
*/
|
||||
export const addImagePost = (uid: string, post: any) => {
|
||||
return {
|
||||
@@ -348,4 +333,3 @@ export const addImagePost = (uid: string, post: any) => {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { firebaseRef } from 'app/firebase/'
|
||||
|
||||
// - Import domain
|
||||
import { Profile } from "domain/users";
|
||||
import { Profile } from 'domain/users'
|
||||
|
||||
// - Import action types
|
||||
import {UserActionType} from 'constants/userActionType'
|
||||
@@ -11,7 +11,7 @@ import {UserActionType} from 'constants/userActionType'
|
||||
import * as globalActions from 'actions/globalActions'
|
||||
import * as userActions from 'actions/userActions'
|
||||
|
||||
declare const console: any;
|
||||
declare const console: any
|
||||
|
||||
/* _____________ CRUD DB _____________ */
|
||||
|
||||
@@ -23,10 +23,10 @@ export const dbGetUserInfo = () => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
let uid: string = getState().authorize.uid
|
||||
if (uid) {
|
||||
let userProfileRef: any = firebaseRef.child(`users/${uid}/info`);
|
||||
let userProfileRef: any = firebaseRef.child(`users/${uid}/info`)
|
||||
|
||||
return userProfileRef.once('value').then((snapshot: any) => {
|
||||
let userProfile: Profile = snapshot.val() || {};
|
||||
let userProfile: Profile = snapshot.val() || {}
|
||||
|
||||
dispatch(addUserInfo(uid, {
|
||||
avatar: userProfile.avatar,
|
||||
@@ -35,7 +35,7 @@ export const dbGetUserInfo = () => {
|
||||
banner: userProfile.banner,
|
||||
tagLine: userProfile.tagLine
|
||||
}))
|
||||
}, (error: any) => console.log(error));
|
||||
}, (error: any) => console.log(error))
|
||||
|
||||
}
|
||||
}
|
||||
@@ -49,10 +49,10 @@ export const dbGetUserInfo = () => {
|
||||
export const dbGetUserInfoByUserId = (uid: string, callerKey: string) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
if (uid) {
|
||||
let userProfileRef: any = firebaseRef.child(`users/${uid}/info`);
|
||||
let userProfileRef: any = firebaseRef.child(`users/${uid}/info`)
|
||||
|
||||
return userProfileRef.once('value').then((snapshot: any) => {
|
||||
let userProfile = snapshot.val() || {};
|
||||
let userProfile = snapshot.val() || {}
|
||||
dispatch(addUserInfo(uid, {
|
||||
avatar: userProfile.avatar,
|
||||
email: userProfile.email,
|
||||
@@ -64,12 +64,12 @@ export const dbGetUserInfoByUserId = (uid: string, callerKey: string) => {
|
||||
case 'header':
|
||||
dispatch(globalActions.setHeaderTitle(userProfile.fullName))
|
||||
|
||||
break;
|
||||
break
|
||||
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
}, (error: any) => console.log(error));
|
||||
}, (error: any) => console.log(error))
|
||||
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ export const dbUpdateUserInfo = (newProfile: Profile) => {
|
||||
let uid: string = getState().authorize.uid
|
||||
|
||||
// Write the new data simultaneously in the list
|
||||
let updates: any = {};
|
||||
let updates: any = {}
|
||||
let profile = getState().user.info[uid]
|
||||
let updateProfie: Profile = {
|
||||
avatar: newProfile.avatar || profile.avatar || '',
|
||||
@@ -112,12 +112,12 @@ export const dbGetPeopleInfo = () => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
let uid: string = getState().authorize.uid
|
||||
if (uid) {
|
||||
let peopleRef: any = firebaseRef.child(`users`);
|
||||
let peopleRef: any = firebaseRef.child(`users`)
|
||||
|
||||
return peopleRef.once('value').then((snapshot: any) => {
|
||||
let people = snapshot.val() || {};
|
||||
let people = snapshot.val() || {}
|
||||
|
||||
let parsedPeople: {[userId: string]: Profile} = {};
|
||||
let parsedPeople: {[userId: string]: Profile} = {}
|
||||
Object.keys(people).forEach((userId) => {
|
||||
if (userId !== uid) {
|
||||
let userInfo = people[userId].info
|
||||
@@ -132,7 +132,7 @@ export const dbGetPeopleInfo = () => {
|
||||
|
||||
})
|
||||
dispatch(addPeopleInfo(parsedPeople))
|
||||
}, (error: any) => console.log(error));
|
||||
}, (error: any) => console.log(error))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@ import { firebaseRef } from 'app/firebase/'
|
||||
import {VoteActionType} from 'constants/voteActionType'
|
||||
|
||||
// - Import domain
|
||||
import { Vote } from "domain/votes";
|
||||
import { Vote } from 'domain/votes'
|
||||
|
||||
// - Import actions
|
||||
import * as globalActions from 'actions/globalActions'
|
||||
import * as notifyActions from 'actions/notifyActions'
|
||||
|
||||
declare const console: any;
|
||||
declare const console: any
|
||||
/* _____________ CRUD DB _____________ */
|
||||
|
||||
/**
|
||||
@@ -22,8 +22,8 @@ declare const console: any;
|
||||
export const dbAddVote = (postId: string,ownerPostUserId: string) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
let uid: string = getState().authorize.uid;
|
||||
var vote: Vote = {
|
||||
let uid: string = getState().authorize.uid
|
||||
let vote: Vote = {
|
||||
postId: postId,
|
||||
creationDate: moment().unix(),
|
||||
userDisplayName: getState().user.info[uid].fullName,
|
||||
@@ -31,7 +31,7 @@ export const dbAddVote = (postId: string,ownerPostUserId: string) => {
|
||||
userId: uid
|
||||
}
|
||||
|
||||
var voteRef = firebaseRef.child(`postVotes/${postId}`).push(vote)
|
||||
let voteRef = firebaseRef.child(`postVotes/${postId}`).push(vote)
|
||||
return voteRef.then(() => {
|
||||
dispatch(addVote(
|
||||
{
|
||||
@@ -60,10 +60,10 @@ export const dbGetVotes = () => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
let uid: string = getState().authorize.uid
|
||||
if (uid) {
|
||||
let votesRef: any = firebaseRef.child(`postVotes`);
|
||||
let votesRef: any = firebaseRef.child(`postVotes`)
|
||||
|
||||
return votesRef.on('value',(snapshot: any) => {
|
||||
let postVotes: {[postId:string]: {[voteId: string]: Vote}} = snapshot.val() || {};
|
||||
let postVotes: {[postId:string]: {[voteId: string]: Vote}} = snapshot.val() || {}
|
||||
dispatch(addVoteList(postVotes))
|
||||
})
|
||||
|
||||
@@ -81,15 +81,15 @@ export const dbDeleteVote = (postId: string) => {
|
||||
return (dispatch: any, getState: Function) => {
|
||||
|
||||
// Get current user id
|
||||
let uid: string = getState().authorize.uid;
|
||||
let uid: string = getState().authorize.uid
|
||||
|
||||
// Write the new data simultaneously in the list
|
||||
var updates: any = {};
|
||||
let updates: any = {}
|
||||
let votes: {[voteId: string]: Vote} = getState().vote.postVotes[postId]
|
||||
let id: string = Object.keys(votes).filter((key)=> votes[key].userId === uid)[0]
|
||||
|
||||
|
||||
updates[`postVotes/${postId}/${id}`] = null;
|
||||
updates[`postVotes/${postId}/${id}`] = null
|
||||
|
||||
return firebaseRef.update(updates).then((result) => {
|
||||
dispatch(deleteVote(id, postId))
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// - Import firebase components
|
||||
import {firebaseAuth, firebaseRef} from 'app/firebase/';
|
||||
import store from 'store/configureStore';
|
||||
import {firebaseAuth, firebaseRef} from 'app/firebase/'
|
||||
import store from 'store/configureStore'
|
||||
|
||||
// - Check user if is authorized
|
||||
export var isAuthorized = () => {
|
||||
var state = store.getState();
|
||||
return state.authorize.authed;
|
||||
export let isAuthorized = () => {
|
||||
let state = store.getState()
|
||||
return state.authorize.authed
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
export var isAdmin = () =>{
|
||||
export let isAdmin = () =>{
|
||||
|
||||
return true;
|
||||
return true
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import {Route, Redirect} from 'react-router-dom'
|
||||
import * as AuthAPI from 'AuthAPI'
|
||||
|
||||
|
||||
export var PrivateRoute = ({component: Component, ...rest}) => {
|
||||
console.log('is auth ; ', AuthAPI.isAuthorized());
|
||||
export let PrivateRoute = ({component: Component, ...rest}) => {
|
||||
console.log('is auth ', AuthAPI.isAuthorized())
|
||||
return (
|
||||
<Route
|
||||
{...rest}
|
||||
@@ -18,7 +18,7 @@ export var PrivateRoute = ({component: Component, ...rest}) => {
|
||||
)
|
||||
}
|
||||
|
||||
export var PublicRoute = ({component: Component,...rest}) => {
|
||||
export let PublicRoute = ({component: Component,...rest}) => {
|
||||
return (
|
||||
<Route
|
||||
{...rest}
|
||||
|
||||
@@ -5,18 +5,18 @@ import { storageRef } from 'app/firebase/'
|
||||
|
||||
// - Get file Extension
|
||||
const getExtension = (fileName) => {
|
||||
var re = /(?:\.([^.]+))?$/;
|
||||
return re.exec(fileName)[1];
|
||||
let re = /(?:\.([^.]+))?$/
|
||||
return re.exec(fileName)[1]
|
||||
}
|
||||
|
||||
// Converts image to canvas; returns new canvas element
|
||||
// Converts image to canvas returns new canvas element
|
||||
const convertImageToCanvas = (image) => {
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
canvas.getContext("2d").drawImage(image, 0, 0);
|
||||
let canvas = document.createElement('canvas')
|
||||
canvas.width = image.width
|
||||
canvas.height = image.height
|
||||
canvas.getContext('2d').drawImage(image, 0, 0)
|
||||
|
||||
return canvas;
|
||||
return canvas
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,10 +28,10 @@ const uploadImage = (file, fileName, progress) => {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
// Create a storage refrence
|
||||
var storegeFile = storageRef.child(`images/${fileName}`)
|
||||
let storegeFile = storageRef.child(`images/${fileName}`)
|
||||
|
||||
// Upload file
|
||||
var task = storegeFile.put(file)
|
||||
let task = storegeFile.put(file)
|
||||
task.then((result) => {
|
||||
resolve(result)
|
||||
}).catch((error) => {
|
||||
@@ -40,7 +40,7 @@ const uploadImage = (file, fileName, progress) => {
|
||||
|
||||
// Upload storage bar
|
||||
task.on('state_changed', (snapshot) => {
|
||||
var percentage = (snapshot.bytesTransferred / snapshot.totalBytes) * 100
|
||||
let percentage = (snapshot.bytesTransferred / snapshot.totalBytes) * 100
|
||||
progress(percentage, true)
|
||||
}, (error) => {
|
||||
console.log('========== Upload Image ============')
|
||||
@@ -65,40 +65,40 @@ const constraintImage = (file,fileName, maxWidth, maxHeight) => {
|
||||
if(file.type.match(/image.*/)) {
|
||||
|
||||
// Load the image
|
||||
var reader = new FileReader();
|
||||
let reader = new FileReader()
|
||||
reader.onload = function (readerEvent) {
|
||||
var image = new Image();
|
||||
let image = new Image()
|
||||
image.onload = function (imageEvent) {
|
||||
|
||||
// Resize the image
|
||||
var canvas = document.createElement('canvas'),
|
||||
let canvas = document.createElement('canvas'),
|
||||
max_size = 986,// TODO : pull max size from a site config
|
||||
width = image.width,
|
||||
height = image.height;
|
||||
height = image.height
|
||||
if (width > height) {
|
||||
if (width > max_size) {
|
||||
height *= max_size / width;
|
||||
width = max_size;
|
||||
height *= max_size / width
|
||||
width = max_size
|
||||
}
|
||||
} else {
|
||||
if (height > max_size) {
|
||||
width *= max_size / height;
|
||||
height = max_size;
|
||||
width *= max_size / height
|
||||
height = max_size
|
||||
}
|
||||
}
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
canvas.getContext('2d').drawImage(image, 0, 0, width, height);
|
||||
var dataUrl = canvas.toDataURL();
|
||||
var resizedImage = dataURLToBlob(dataUrl);
|
||||
let evt = new CustomEvent('onSendResizedImage', { detail: {resizedImage,fileName} });
|
||||
window.dispatchEvent(evt);
|
||||
canvas.width = width
|
||||
canvas.height = height
|
||||
canvas.getContext('2d').drawImage(image, 0, 0, width, height)
|
||||
let dataUrl = canvas.toDataURL()
|
||||
let resizedImage = dataURLToBlob(dataUrl)
|
||||
let evt = new CustomEvent('onSendResizedImage', { detail: {resizedImage,fileName} })
|
||||
window.dispatchEvent(evt)
|
||||
|
||||
|
||||
}
|
||||
image.src = readerEvent.target.result;
|
||||
image.src = readerEvent.target.result
|
||||
}
|
||||
reader.readAsDataURL(file);
|
||||
reader.readAsDataURL(file)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,23 +109,23 @@ const constraintImage = (file,fileName, maxWidth, maxHeight) => {
|
||||
*/
|
||||
const dataURLToBlob = (dataURL) => {
|
||||
|
||||
var BASE64_MARKER = ';base64,'
|
||||
let BASE64_MARKER = 'base64,'
|
||||
if (dataURL.indexOf(BASE64_MARKER) == -1) {
|
||||
var parts = dataURL.split(',')
|
||||
var contentType = parts[0].split(':')[1]
|
||||
var raw = parts[1]
|
||||
let parts = dataURL.split(',')
|
||||
let contentType = parts[0].split(':')[1]
|
||||
let raw = parts[1]
|
||||
|
||||
return new Blob([raw], {type: contentType})
|
||||
}
|
||||
|
||||
var parts = dataURL.split(BASE64_MARKER)
|
||||
var contentType = parts[0].split(':')[1]
|
||||
var raw = window.atob(parts[1])
|
||||
var rawLength = raw.length
|
||||
let parts = dataURL.split(BASE64_MARKER)
|
||||
let contentType = parts[0].split(':')[1]
|
||||
let raw = window.atob(parts[1])
|
||||
let rawLength = raw.length
|
||||
|
||||
var uInt8Array = new Uint8Array(rawLength)
|
||||
let uInt8Array = new Uint8Array(rawLength)
|
||||
|
||||
for (var i = 0; i < rawLength; ++i) {
|
||||
for (let i = 0 i < rawLength ++i) {
|
||||
uInt8Array[i] = raw.charCodeAt(i)
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ export const detectTags = (content,character) => {
|
||||
|
||||
}
|
||||
export const getContentTags = (content) => {
|
||||
var newTags = []
|
||||
var tags = detectTags(content,'#')
|
||||
let newTags = []
|
||||
let tags = detectTags(content,'#')
|
||||
tags.forEach((tag)=>{
|
||||
newTags.push(tag.slice(1))
|
||||
})
|
||||
@@ -17,13 +17,13 @@ export const getContentTags = (content) => {
|
||||
}
|
||||
|
||||
export const sortObjectsDate = (objects) => {
|
||||
var sortedObjects = objects;
|
||||
let sortedObjects = objects
|
||||
|
||||
// Sort posts with creation date
|
||||
sortedObjects.sort((a, b) => {
|
||||
return parseInt(b.creationDate) - parseInt(a.creationDate)
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
return sortedObjects;
|
||||
return sortedObjects
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { storageRef } from 'app/firebase/'
|
||||
//- Import actions
|
||||
|
||||
const isValidEmail = (email) => {
|
||||
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
let re = /^(([^<>()\[\]\\.,:\s@"]+(\.[^<>()\[\]\\.,:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
return re.test(email)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// - Import react components
|
||||
import React, { Component } from 'react'
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withRouter } from 'react-router-dom'
|
||||
import { connect } from 'react-redux'
|
||||
import PropTypes from 'prop-types'
|
||||
import { Card, CardActions, CardHeader, CardMedia, CardTitle, CardText } from 'material-ui/Card'
|
||||
@@ -120,8 +120,8 @@ export class Blog extends Component {
|
||||
}
|
||||
else {
|
||||
|
||||
var postBack = { oddPostList: [], evenPostList: [] }
|
||||
var parsedPosts = []
|
||||
let postBack = { oddPostList: [], evenPostList: [] }
|
||||
let parsedPosts = []
|
||||
Object.keys(posts).forEach((postId) => {
|
||||
if(tag){
|
||||
let regex = new RegExp("#" + tag,'g')
|
||||
@@ -142,7 +142,7 @@ export class Blog extends Component {
|
||||
}
|
||||
sortedPosts.forEach((post, index) => {
|
||||
|
||||
var newPost = (
|
||||
let newPost = (
|
||||
<div key={post.id}>
|
||||
|
||||
{index > 1 || (!postBack.divided && index > 0) ? <div style={{ height: "16px" }}></div> : ''}
|
||||
|
||||
@@ -120,17 +120,17 @@ static propTypes = {
|
||||
* @return {DOM} list of comments' DOM
|
||||
*/
|
||||
commentList = () => {
|
||||
var comments = this.props.comments
|
||||
let comments = this.props.comments
|
||||
if (comments) {
|
||||
|
||||
|
||||
var parsedComments = [];
|
||||
let parsedComments = []
|
||||
Object.keys(comments).slice(0, 3).forEach((commentId) => {
|
||||
parsedComments.push({
|
||||
id: commentId,
|
||||
...comments[commentId]
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
if (parsedComments.length === 2) {
|
||||
parsedComments.push(parsedComments[0])
|
||||
}
|
||||
@@ -230,7 +230,7 @@ static propTypes = {
|
||||
</Paper>
|
||||
</div>): ''}
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// - Import react components
|
||||
import React, { Component } from 'react'
|
||||
import { connect } from 'react-redux';
|
||||
import { connect } from 'react-redux'
|
||||
import PropTypes from 'prop-types'
|
||||
import { List, ListItem } from 'material-ui/List'
|
||||
|
||||
@@ -57,17 +57,17 @@ export class CommentList extends Component {
|
||||
* @return {DOM} list of comments' DOM
|
||||
*/
|
||||
commentList = () => {
|
||||
var comments = this.props.comments
|
||||
let comments = this.props.comments
|
||||
if (comments) {
|
||||
|
||||
|
||||
var parsedComments = [];
|
||||
let parsedComments = []
|
||||
Object.keys(comments).forEach((commentId) => {
|
||||
parsedComments.push({
|
||||
id: commentId,
|
||||
...comments[commentId]
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
let sortedComments = PostAPI.sortObjectsDate(parsedComments)
|
||||
|
||||
return sortedComments.map((comment, index, array) => {
|
||||
|
||||
@@ -11,21 +11,21 @@ import * as commentActions from 'commentActions'
|
||||
// - Define variable
|
||||
const buttonStyle = {
|
||||
marginTop: '5px'
|
||||
};
|
||||
}
|
||||
|
||||
// - Create CommentWrite component class
|
||||
export class CommentWrite extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
inputValue:''
|
||||
}
|
||||
|
||||
// Binding functions to `this`
|
||||
this.handleRef = this.handleRef.bind(this);
|
||||
this.focus = this.focus.bind(this);
|
||||
this.handleAddComment = this.handleAddComment.bind(this);
|
||||
this.handleRef = this.handleRef.bind(this)
|
||||
this.focus = this.focus.bind(this)
|
||||
this.handleAddComment = this.handleAddComment.bind(this)
|
||||
this.handleOnChange = this.handleOnChange.bind(this)
|
||||
|
||||
}
|
||||
@@ -56,7 +56,7 @@ export class CommentWrite extends Component {
|
||||
<Button basic style={buttonStyle} onClick={this.handleAddComment} color='teal'>Add Comment</Button>
|
||||
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,9 +153,9 @@ export class EditProfile extends Component {
|
||||
* Set banner image url
|
||||
*/
|
||||
handleRequestSetBanner = (url) => {
|
||||
console.log('==========Banner==================');
|
||||
console.log(url);
|
||||
console.log('====================================');
|
||||
console.log('==========Banner==================')
|
||||
console.log(url)
|
||||
console.log('====================================')
|
||||
this.setState({
|
||||
banner: url
|
||||
})
|
||||
@@ -226,7 +226,7 @@ export class EditProfile extends Component {
|
||||
handleResize = (evt) => {
|
||||
|
||||
// Set initial state
|
||||
var width = window.innerWidth
|
||||
let width = window.innerWidth
|
||||
|
||||
if (width > 900) {
|
||||
this.setState({
|
||||
|
||||
@@ -90,12 +90,12 @@ export class HomeHeader extends Component {
|
||||
*/
|
||||
handleNotifyTouchTap = (event) => {
|
||||
// This prevents ghost click.
|
||||
event.preventDefault();
|
||||
event.preventDefault()
|
||||
|
||||
this.setState({
|
||||
openNotifyMenu: true,
|
||||
anchorEl: event.currentTarget,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,12 +106,12 @@ export class HomeHeader extends Component {
|
||||
*/
|
||||
handleAvatarTouchTap = (event) => {
|
||||
// This prevents ghost click.
|
||||
event.preventDefault();
|
||||
event.preventDefault()
|
||||
|
||||
this.setState({
|
||||
openAvatarMenu: true,
|
||||
anchorEl: event.currentTarget,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,8 +133,8 @@ export class HomeHeader extends Component {
|
||||
handleRequestClose = () => {
|
||||
this.setState({
|
||||
openAvatarMenu: false,
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -144,7 +144,7 @@ export class HomeHeader extends Component {
|
||||
handleResize = (evt) => {
|
||||
|
||||
// Set initial state
|
||||
var width = window.innerWidth
|
||||
let width = window.innerWidth
|
||||
|
||||
if (width >= 600 && !this.state.showTitle) {
|
||||
this.setState({
|
||||
@@ -171,7 +171,7 @@ export class HomeHeader extends Component {
|
||||
/**
|
||||
* Styles
|
||||
*/
|
||||
var styles = {
|
||||
let styles = {
|
||||
toolbarStyle: {
|
||||
backgroundColor: "",
|
||||
transition: "all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",
|
||||
|
||||
@@ -6,7 +6,7 @@ import { GridList, GridTile } from 'material-ui/GridList'
|
||||
import IconButton from 'material-ui/IconButton'
|
||||
import Subheader from 'material-ui/Subheader'
|
||||
import StarBorder from 'material-ui/svg-icons/toggle/star-border'
|
||||
import FloatingActionButton from 'material-ui/FloatingActionButton';
|
||||
import FloatingActionButton from 'material-ui/FloatingActionButton'
|
||||
import SvgUpload from 'material-ui/svg-icons/file/cloud-upload'
|
||||
import SvgAddImage from 'material-ui/svg-icons/image/add-a-photo'
|
||||
import SvgDelete from 'material-ui/svg-icons/action/delete'
|
||||
@@ -43,7 +43,7 @@ export class ImageGallery extends Component {
|
||||
* @param {object} props is an object properties of component
|
||||
*/
|
||||
constructor(props) {
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
// Binding function to `this`
|
||||
this.close = this.close.bind(this)
|
||||
@@ -106,7 +106,7 @@ export class ImageGallery extends Component {
|
||||
onFileChange = (evt) => {
|
||||
|
||||
const extension = FileAPI.getExtension(evt.target.files[0].name)
|
||||
var fileName = (`${uuid()}.${extension}`)
|
||||
let fileName = (`${uuid()}.${extension}`)
|
||||
let image = FileAPI.constraintImage(evt.target.files[0], fileName)
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export class Login extends Component {
|
||||
* @param {object} props is an object properties of component
|
||||
*/
|
||||
constructor(props) {
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
emailInput: '',
|
||||
@@ -40,12 +40,12 @@ export class Login extends Component {
|
||||
* @param {event} evt is an event of inputs of element on change
|
||||
*/
|
||||
handleInputChange = (evt) => {
|
||||
const target = evt.target;
|
||||
const value = target.type === 'checkbox' ? target.checked : target.value;
|
||||
const name = target.name;
|
||||
const target = evt.target
|
||||
const value = target.type === 'checkbox' ? target.checked : target.value
|
||||
const name = target.name
|
||||
this.setState({
|
||||
[name]: value
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
switch (name) {
|
||||
@@ -60,7 +60,7 @@ export class Login extends Component {
|
||||
passwordInputError: ''
|
||||
})
|
||||
|
||||
break;
|
||||
break
|
||||
default:
|
||||
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export class Login extends Component {
|
||||
*/
|
||||
handleForm = () => {
|
||||
|
||||
var error = false
|
||||
let error = false
|
||||
if (this.state.emailInput === '') {
|
||||
this.setState({
|
||||
emailInputError: 'This field is required'
|
||||
@@ -110,7 +110,7 @@ export class Login extends Component {
|
||||
textAlign: 'center',
|
||||
display: 'block',
|
||||
margin: "auto"
|
||||
};
|
||||
}
|
||||
return (
|
||||
<form>
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@ export interface IMasterState {
|
||||
* @type {Boolean}
|
||||
* @memberof IMasterState
|
||||
*/
|
||||
authed:Boolean;
|
||||
authed:Boolean
|
||||
/**
|
||||
* It's true if all default data loaded from database
|
||||
*
|
||||
* @type {Boolean}
|
||||
* @memberof IMasterState
|
||||
*/
|
||||
dataLoaded:Boolean;
|
||||
dataLoaded:Boolean
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { connect } from 'react-redux'
|
||||
import { Route, Switch, NavLink, withRouter, Redirect } from 'react-router-dom'
|
||||
import { firebaseAuth, firebaseRef } from 'app/firebase'
|
||||
import { push } from 'react-router-redux'
|
||||
import Snackbar from 'material-ui/Snackbar';
|
||||
import Snackbar from 'material-ui/Snackbar'
|
||||
import LinearProgress from 'material-ui/LinearProgress'
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import Signup from 'components/Signup'
|
||||
import Login from 'components/Login'
|
||||
import Settings from 'components/Settings'
|
||||
import MasterLoading from 'components/MasterLoading'
|
||||
import { IMasterProps } from "./IMasterProps";
|
||||
import { IMasterState } from "./IMasterState";
|
||||
import { IMasterProps } from "./IMasterProps"
|
||||
import { IMasterState } from "./IMasterState"
|
||||
|
||||
|
||||
// - Import API
|
||||
@@ -45,12 +45,12 @@ export class Master extends Component<IMasterProps,IMasterState>{
|
||||
static isPrivate = true
|
||||
// Constructor
|
||||
constructor(props : IMasterProps) {
|
||||
super(props);
|
||||
super(props)
|
||||
this.state = {
|
||||
loading: true,
|
||||
authed: false,
|
||||
dataLoaded: false
|
||||
};
|
||||
}
|
||||
|
||||
// Binding functions to `this`
|
||||
this.handleLoading = this.handleLoading.bind(this)
|
||||
@@ -207,7 +207,7 @@ const mapDispatchToProps = (dispatch : any, ownProps : any) => {
|
||||
* @param {object} state
|
||||
*/
|
||||
const mapStateToProps = (state : any) => {
|
||||
const {authorize, global, user, post, comment, imageGallery , vote, notify,circle } = state;
|
||||
const {authorize, global, user, post, comment, imageGallery , vote, notify,circle } = state
|
||||
return {
|
||||
guest: authorize.guest,
|
||||
uid: authorize.uid,
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
import Master from './Master';
|
||||
export default Master;
|
||||
import Master from './Master'
|
||||
export default Master
|
||||
|
||||
@@ -12,7 +12,7 @@ export default class MasterLoading extends Component {
|
||||
|
||||
// Constructor
|
||||
constructor(props) {
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
|
||||
// Binding functions to `this`
|
||||
@@ -49,7 +49,7 @@ export default class MasterLoading extends Component {
|
||||
|
||||
|
||||
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,15 +53,15 @@ export class People extends Component {
|
||||
case undefined:
|
||||
case '':
|
||||
this.props.setHeaderTitle('People')
|
||||
break;
|
||||
break
|
||||
case 'circles':
|
||||
this.props.setHeaderTitle('Circles')
|
||||
break;
|
||||
break
|
||||
case 'followers':
|
||||
this.props.setHeaderTitle('Followers')
|
||||
break;
|
||||
break
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
@@ -98,15 +98,15 @@ export class People extends Component {
|
||||
case undefined:
|
||||
case '':
|
||||
tabIndex = 0
|
||||
break;
|
||||
break
|
||||
case 'circles':
|
||||
tabIndex = 1
|
||||
break;
|
||||
break
|
||||
case 'followers':
|
||||
tabIndex = 2
|
||||
break;
|
||||
break
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
return (
|
||||
<div style={styles.people}>
|
||||
|
||||
@@ -297,7 +297,7 @@ static propTypes = {
|
||||
this.setState({
|
||||
readMoreState: !this.state.readMoreState
|
||||
|
||||
});
|
||||
})
|
||||
}
|
||||
componentDidMount() {
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import { connect } from 'react-redux'
|
||||
import PropTypes from 'prop-types'
|
||||
import { List, ListItem } from 'material-ui/List'
|
||||
import Paper from 'material-ui/Paper'
|
||||
import Dialog from 'material-ui/Dialog';
|
||||
import FlatButton from 'material-ui/FlatButton';
|
||||
import RaisedButton from 'material-ui/RaisedButton';
|
||||
import Dialog from 'material-ui/Dialog'
|
||||
import FlatButton from 'material-ui/FlatButton'
|
||||
import RaisedButton from 'material-ui/RaisedButton'
|
||||
import { grey400, grey800, darkBlack, lightBlack } from 'material-ui/styles/colors'
|
||||
import IconButton from 'material-ui/IconButton'
|
||||
import TextField from 'material-ui/TextField'
|
||||
@@ -182,7 +182,7 @@ export class PostWrite extends Component {
|
||||
post,
|
||||
update } = this.props
|
||||
|
||||
var tags = PostAPI.getContentTags(postText)
|
||||
let tags = PostAPI.getContentTags(postText)
|
||||
|
||||
// In edit status we should fire update if not we should fire post function
|
||||
if (!edit) {
|
||||
@@ -329,9 +329,9 @@ export class PostWrite extends Component {
|
||||
<MenuItem onClick={this.handleToggleSharing} style={{ fontSize: "14px" }}>{!this.state.disableSharing ? 'Disable sharing' : 'Enable sharing'}</MenuItem>
|
||||
</IconMenu>
|
||||
)
|
||||
var postAvatar = <UserAvatar fullName={this.props.name} fileName={this.props.avatar} style={{ top: "8px" }} size={40} />
|
||||
let postAvatar = <UserAvatar fullName={this.props.name} fileName={this.props.avatar} style={{ top: "8px" }} size={40} />
|
||||
|
||||
var author = (
|
||||
let author = (
|
||||
<div>
|
||||
<span style={{
|
||||
fontSize: "14px",
|
||||
|
||||
@@ -91,7 +91,7 @@ export class ProfileHead extends Component {
|
||||
handleResize = (evt) => {
|
||||
|
||||
// Set initial state
|
||||
var width = window.innerWidth
|
||||
let width = window.innerWidth
|
||||
|
||||
if (width > 900) {
|
||||
this.setState({
|
||||
|
||||
@@ -26,7 +26,7 @@ export class Settings extends Component {
|
||||
* @param {object} props is an object properties of component
|
||||
*/
|
||||
constructor(props) {
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
passwordInput: '',
|
||||
@@ -46,12 +46,12 @@ export class Settings extends Component {
|
||||
* @param {event} evt is an event of inputs of element on change
|
||||
*/
|
||||
handleInputChange = (evt) => {
|
||||
const target = evt.target;
|
||||
const value = target.type === 'checkbox' ? target.checked : target.value;
|
||||
const name = target.name;
|
||||
const target = evt.target
|
||||
const value = target.type === 'checkbox' ? target.checked : target.value
|
||||
const name = target.name
|
||||
this.setState({
|
||||
[name]: value
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
switch (name) {
|
||||
@@ -66,7 +66,7 @@ export class Settings extends Component {
|
||||
passwordInputError: ''
|
||||
})
|
||||
|
||||
break;
|
||||
break
|
||||
default:
|
||||
|
||||
}
|
||||
@@ -77,7 +77,7 @@ export class Settings extends Component {
|
||||
*/
|
||||
handleForm = () => {
|
||||
|
||||
var error = false
|
||||
let error = false
|
||||
if (this.state.passwordInput === '') {
|
||||
this.setState({
|
||||
passwordInputError: 'This field is required'
|
||||
@@ -122,7 +122,7 @@ export class Settings extends Component {
|
||||
textAlign: 'center',
|
||||
display: 'block',
|
||||
margin: "auto"
|
||||
};
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ import * as authorizeActions from 'authorizeActions'
|
||||
import * as globalActions from 'globalActions'
|
||||
|
||||
// - Feilds
|
||||
const color = 'teal';
|
||||
const colorKey = 'blue';
|
||||
const color = 'teal'
|
||||
const colorKey = 'blue'
|
||||
const sizeCondition = (width) => (width >= 750)
|
||||
|
||||
|
||||
@@ -124,12 +124,12 @@ export class Sidebar extends Component {
|
||||
this.setState({
|
||||
auto: true
|
||||
})
|
||||
break;
|
||||
break
|
||||
case 'overlay':
|
||||
this.setState({
|
||||
shouldBeClosed: true
|
||||
})
|
||||
break;
|
||||
break
|
||||
default:
|
||||
|
||||
}
|
||||
@@ -159,7 +159,7 @@ export class Sidebar extends Component {
|
||||
handleResize = (evt) => {
|
||||
|
||||
// Set initial state
|
||||
var width = window.innerWidth
|
||||
let width = window.innerWidth
|
||||
|
||||
if (sizeCondition(width)) {
|
||||
|
||||
@@ -202,7 +202,7 @@ export class Sidebar extends Component {
|
||||
* Handle logout user
|
||||
*/
|
||||
handleLogout = () => {
|
||||
var { dispatch } = this.props
|
||||
let { dispatch } = this.props
|
||||
dispatch(authorizeActions.dbLogout())
|
||||
|
||||
}
|
||||
@@ -215,7 +215,7 @@ export class Sidebar extends Component {
|
||||
handleKeyUp = (evt) => {
|
||||
if (this.state.overlayOpen) {
|
||||
if (this.state.open && keycode(event) === 'esc') {
|
||||
this.open(false);
|
||||
this.open(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export class Signup extends Component {
|
||||
* @param {object} props is an object properties of component
|
||||
*/
|
||||
constructor(props){
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
fullNameInput: '',
|
||||
@@ -82,7 +82,7 @@ export class Signup extends Component {
|
||||
this.setState({
|
||||
checkInputError: ''
|
||||
})
|
||||
break;
|
||||
break
|
||||
default:
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ export class Signup extends Component {
|
||||
const {fullNameInput, emailInput, passwordInput, confirmInput} = this.state
|
||||
const {register} = this.props
|
||||
|
||||
var error = false
|
||||
let error = false
|
||||
|
||||
// Validate full name
|
||||
let fullNameCheck = fullNameInput.trim().toLowerCase()
|
||||
@@ -165,7 +165,7 @@ export class Signup extends Component {
|
||||
textAlign: 'center',
|
||||
display: 'block',
|
||||
margin: "auto"
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import PropTypes from 'prop-types'
|
||||
import {push} from 'react-router-redux'
|
||||
import Paper from 'material-ui/Paper'
|
||||
import FlatButton from 'material-ui/FlatButton'
|
||||
import RaisedButton from 'material-ui/RaisedButton';
|
||||
import Popover, { PopoverAnimationVertical } from 'material-ui/Popover';
|
||||
import Menu from 'material-ui/Menu';
|
||||
import RaisedButton from 'material-ui/RaisedButton'
|
||||
import Popover, { PopoverAnimationVertical } from 'material-ui/Popover'
|
||||
import Menu from 'material-ui/Menu'
|
||||
import MenuItem from 'material-ui/MenuItem'
|
||||
import Checkbox from 'material-ui/Checkbox'
|
||||
import TextField from 'material-ui/TextField'
|
||||
@@ -118,7 +118,7 @@ export class UserBox extends Component {
|
||||
*/
|
||||
handleTouchTap = (evt) => {
|
||||
// This prevents ghost click.
|
||||
event.preventDefault();
|
||||
event.preventDefault()
|
||||
|
||||
this.setState({
|
||||
open: true,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
export enum PostActionType {
|
||||
|
||||
ADD_IMAGE_POST = "ADD_IMAGE_POST",
|
||||
ADD_VIDEO_POST = "ADD_VIDEO_POST",
|
||||
ADD_POST = "ADD_POST",
|
||||
UPDATE_POST = "UPDATE_POST",
|
||||
DELETE_POST = "DELETE_POST",
|
||||
ADD_LIST_POST = "ADD_LIST_POST",
|
||||
CLEAR_ALL_DATA_POST = "CLEAR_ALL_DATA_POST"
|
||||
ADD_IMAGE_POST = 'ADD_IMAGE_POST',
|
||||
ADD_VIDEO_POST = 'ADD_VIDEO_POST',
|
||||
ADD_POST = 'ADD_POST',
|
||||
UPDATE_POST = 'UPDATE_POST',
|
||||
DELETE_POST = 'DELETE_POST',
|
||||
ADD_LIST_POST = 'ADD_LIST_POST',
|
||||
CLEAR_ALL_DATA_POST = 'CLEAR_ALL_DATA_POST'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { LoginUser } from "./loginResult";
|
||||
import { RegisterUserResult } from "./registerUserResult";
|
||||
import { LoginUser } from './loginResult'
|
||||
import { RegisterUserResult } from './registerUserResult'
|
||||
|
||||
export {
|
||||
LoginUser,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { BaseDomain } from "domain/common";
|
||||
import { BaseDomain } from 'domain/common'
|
||||
|
||||
export class LoginUser extends BaseDomain{
|
||||
|
||||
constructor(uid: string){
|
||||
super();
|
||||
super()
|
||||
|
||||
this._uid = uid;
|
||||
this._uid = uid
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15,9 +15,9 @@ export class LoginUser extends BaseDomain{
|
||||
* @memberof LoginUser
|
||||
*/
|
||||
|
||||
private _uid : string;
|
||||
private _uid : string
|
||||
public get uid() : string {
|
||||
return this._uid;
|
||||
return this._uid
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { BaseDomain } from "domain/common";
|
||||
import { BaseDomain } from 'domain/common'
|
||||
|
||||
export class RegisterUserResult extends BaseDomain{
|
||||
|
||||
constructor(uid: string){
|
||||
super();
|
||||
super()
|
||||
|
||||
this._uid = uid;
|
||||
this._uid = uid
|
||||
}
|
||||
/**
|
||||
* User identifier
|
||||
@@ -14,9 +14,9 @@ export class RegisterUserResult extends BaseDomain{
|
||||
* @memberof LoginUser
|
||||
*/
|
||||
|
||||
private _uid : string;
|
||||
public get uid() : string {
|
||||
return this._uid;
|
||||
private _uid : string
|
||||
public get uid (): string {
|
||||
return this._uid
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BaseDomain } from "domain/common";
|
||||
import { User } from "domain/users";
|
||||
import { BaseDomain } from 'domain/common'
|
||||
import { User } from 'domain/users'
|
||||
|
||||
export class Circle extends BaseDomain {
|
||||
|
||||
@@ -9,7 +9,7 @@ export class Circle extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
public id?: string | null;
|
||||
public id?: string | null
|
||||
|
||||
/**
|
||||
* Circle creation date time
|
||||
@@ -17,7 +17,7 @@ export class Circle extends BaseDomain {
|
||||
* @type {Date}
|
||||
* @memberof Circle
|
||||
*/
|
||||
public creationDate?: number;
|
||||
public creationDate?: number
|
||||
|
||||
/**
|
||||
* Circle owner identifier
|
||||
@@ -25,7 +25,7 @@ export class Circle extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Circle
|
||||
*/
|
||||
public ownerId?: string | null;
|
||||
public ownerId?: string | null
|
||||
|
||||
/**
|
||||
* Circle name
|
||||
@@ -33,7 +33,7 @@ export class Circle extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
public name: string;
|
||||
public name: string
|
||||
|
||||
/**
|
||||
* The users in a circle
|
||||
@@ -41,7 +41,7 @@ export class Circle extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
public users: {[userId:string]: User};
|
||||
public users: {[userId:string]: User}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Circle} from './circle';
|
||||
import {UserFollower} from './userFollower';
|
||||
import {Circle} from './circle'
|
||||
import {UserFollower} from './userFollower'
|
||||
|
||||
export {
|
||||
Circle,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseDomain } from "domain/common";
|
||||
import { BaseDomain } from 'domain/common'
|
||||
|
||||
export class UserFollower extends BaseDomain {
|
||||
|
||||
@@ -9,7 +9,7 @@ export class UserFollower extends BaseDomain {
|
||||
* @type {Date}
|
||||
* @memberof Circle
|
||||
*/
|
||||
public creationDate?: number;
|
||||
public creationDate?: number
|
||||
|
||||
/**
|
||||
* User full name
|
||||
@@ -17,7 +17,7 @@ export class UserFollower extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof UserFollower
|
||||
*/
|
||||
public fullName: string;
|
||||
public fullName: string
|
||||
|
||||
/**
|
||||
* Avatar URL address
|
||||
@@ -25,7 +25,7 @@ export class UserFollower extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof UserFollower
|
||||
*/
|
||||
public avatar: string;
|
||||
public avatar: string
|
||||
|
||||
/**
|
||||
* If following user approved {true} or not {false}
|
||||
@@ -33,7 +33,7 @@ export class UserFollower extends BaseDomain {
|
||||
* @type {Boolean}
|
||||
* @memberof UserFollower
|
||||
*/
|
||||
public approved: Boolean;
|
||||
public approved: Boolean
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseDomain } from "domain/common";
|
||||
import { BaseDomain } from 'domain/common'
|
||||
|
||||
export class Comment extends BaseDomain {
|
||||
|
||||
@@ -8,7 +8,7 @@ export class Comment extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Comment
|
||||
*/
|
||||
public postId: string;
|
||||
public postId: string
|
||||
|
||||
/**
|
||||
* Comment text
|
||||
@@ -16,7 +16,7 @@ export class Comment extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Comment
|
||||
*/
|
||||
public text: string;
|
||||
public text: string
|
||||
|
||||
/**
|
||||
* Comment score
|
||||
@@ -24,7 +24,7 @@ export class Comment extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Comment
|
||||
*/
|
||||
public score: number;
|
||||
public score: number
|
||||
|
||||
/**
|
||||
* Comment creation date
|
||||
@@ -32,7 +32,7 @@ export class Comment extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Comment
|
||||
*/
|
||||
public creationDate:number;
|
||||
public creationDate:number
|
||||
|
||||
/**
|
||||
* Comment owner full name
|
||||
@@ -40,7 +40,7 @@ export class Comment extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Comment
|
||||
*/
|
||||
public userDisplayName: string;
|
||||
public userDisplayName: string
|
||||
|
||||
/**
|
||||
* Comment owner avater address
|
||||
@@ -48,7 +48,7 @@ export class Comment extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Comment
|
||||
*/
|
||||
public userAvatar: string;
|
||||
public userAvatar: string
|
||||
|
||||
/**
|
||||
* Comment owner identifier
|
||||
@@ -56,6 +56,6 @@ export class Comment extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Comment
|
||||
*/
|
||||
public userId: string;
|
||||
public userId: string
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Comment} from './comment';
|
||||
import {Comment} from './comment'
|
||||
|
||||
export {
|
||||
Comment
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SocialError } from "./socialError";
|
||||
import { BaseDomain } from "./baseDomain";
|
||||
import { SocialError } from './socialError'
|
||||
import { BaseDomain } from './baseDomain'
|
||||
|
||||
export {
|
||||
SocialError,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export class SocialError{
|
||||
|
||||
constructor(code: string, description: string){
|
||||
this._code = code;
|
||||
this._description = description;
|
||||
this._isError = true;
|
||||
this._code = code
|
||||
this._description = description
|
||||
this._isError = true
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12,9 +12,9 @@ export class SocialError{
|
||||
* @type {string}
|
||||
* @memberof SocialError
|
||||
*/
|
||||
private _code : string;
|
||||
private _code : string
|
||||
public get code() : string {
|
||||
return this._code;
|
||||
return this._code
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,9 +24,9 @@ export class SocialError{
|
||||
* @memberof SocialError
|
||||
*/
|
||||
|
||||
private _description : string;
|
||||
private _description : string
|
||||
public get description() : string {
|
||||
return this._description;
|
||||
return this._description
|
||||
}
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ export class SocialError{
|
||||
* @memberof SocialError
|
||||
*/
|
||||
|
||||
private _isError : Boolean;
|
||||
private _isError : Boolean
|
||||
public get isError() : Boolean {
|
||||
return this._isError;
|
||||
return this._isError
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseDomain } from "domain/common";
|
||||
import { BaseDomain } from 'domain/common'
|
||||
|
||||
export class Image extends BaseDomain {
|
||||
|
||||
@@ -8,7 +8,7 @@ export class Image extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Image
|
||||
*/
|
||||
public id?: string | null;
|
||||
public id?: string | null
|
||||
|
||||
/**
|
||||
* Image creation date
|
||||
@@ -16,7 +16,7 @@ export class Image extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Image
|
||||
*/
|
||||
public creationDate: number;
|
||||
public creationDate: number
|
||||
|
||||
/**
|
||||
* Image delete date
|
||||
@@ -24,7 +24,7 @@ export class Image extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Image
|
||||
*/
|
||||
public deleteDate: string;
|
||||
public deleteDate: string
|
||||
|
||||
/**
|
||||
* Image URL address
|
||||
@@ -32,7 +32,7 @@ export class Image extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Image
|
||||
*/
|
||||
public URL: string;
|
||||
public URL: string
|
||||
|
||||
/**
|
||||
* Image folder name with image name {folderName/imageName}
|
||||
@@ -40,7 +40,7 @@ export class Image extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Image
|
||||
*/
|
||||
public fullPath: string;
|
||||
public fullPath: string
|
||||
|
||||
/**
|
||||
* Image owner identifier
|
||||
@@ -48,7 +48,7 @@ export class Image extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Image
|
||||
*/
|
||||
public ownerUserId: string;
|
||||
public ownerUserId: string
|
||||
|
||||
/**
|
||||
* Last edit date
|
||||
@@ -56,7 +56,7 @@ export class Image extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Image
|
||||
*/
|
||||
public lastEditDate: number;
|
||||
public lastEditDate: number
|
||||
|
||||
/**
|
||||
* If the image was deleted {true} or not {false}
|
||||
@@ -64,6 +64,6 @@ export class Image extends BaseDomain {
|
||||
* @type {Boolean}
|
||||
* @memberof Image
|
||||
*/
|
||||
public deleted: Boolean;
|
||||
public deleted: Boolean
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Image } from "./image";
|
||||
import { Image } from './image'
|
||||
|
||||
export {
|
||||
Image
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Notification} from './notification';
|
||||
import {Notification} from './notification'
|
||||
|
||||
export {
|
||||
Notification
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseDomain } from "domain/common";
|
||||
import { BaseDomain } from 'domain/common'
|
||||
|
||||
export class Notification extends BaseDomain {
|
||||
|
||||
@@ -8,7 +8,7 @@ export class Notification extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Notification
|
||||
*/
|
||||
public description: string;
|
||||
public description: string
|
||||
|
||||
/**
|
||||
* The URL which notification refer to
|
||||
@@ -16,7 +16,7 @@ export class Notification extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Notification
|
||||
*/
|
||||
public url: string;
|
||||
public url: string
|
||||
|
||||
/**
|
||||
* The identifier of the user who makes the notification
|
||||
@@ -24,7 +24,7 @@ export class Notification extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Notification
|
||||
*/
|
||||
public notifierUserId: string;
|
||||
public notifierUserId: string
|
||||
|
||||
/**
|
||||
* The identifier of the user who receive the notification
|
||||
@@ -32,7 +32,7 @@ export class Notification extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Notification
|
||||
*/
|
||||
public notifyRecieverUserId: string;
|
||||
public notifyRecieverUserId: string
|
||||
|
||||
/**
|
||||
* If the notification is seen {true} or not {false}
|
||||
@@ -40,6 +40,6 @@ export class Notification extends BaseDomain {
|
||||
* @type {Boolean}
|
||||
* @memberof Notification
|
||||
*/
|
||||
public isSeen: Boolean;
|
||||
public isSeen: Boolean
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Post} from './post';
|
||||
import {Post} from './post'
|
||||
|
||||
export {
|
||||
Post
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseDomain } from "domain/common";
|
||||
import { BaseDomain } from 'domain/common'
|
||||
|
||||
export class Post extends BaseDomain {
|
||||
|
||||
@@ -8,7 +8,7 @@ export class Post extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Post
|
||||
*/
|
||||
public id?: string | null;
|
||||
public id?: string | null
|
||||
|
||||
/**
|
||||
* The identifier of post type
|
||||
@@ -16,7 +16,7 @@ export class Post extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Post
|
||||
*/
|
||||
public postTypeId: number;
|
||||
public postTypeId: number
|
||||
|
||||
/**
|
||||
* The post creation date
|
||||
@@ -24,7 +24,7 @@ export class Post extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Post
|
||||
*/
|
||||
public creationDate:number;
|
||||
public creationDate:number
|
||||
|
||||
/**
|
||||
* The post delete date
|
||||
@@ -32,7 +32,7 @@ export class Post extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Post
|
||||
*/
|
||||
public deleteDate: number;
|
||||
public deleteDate: number
|
||||
|
||||
/**
|
||||
* The score of post
|
||||
@@ -40,7 +40,7 @@ export class Post extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Post
|
||||
*/
|
||||
public score: number;
|
||||
public score: number
|
||||
|
||||
/**
|
||||
* Post view count
|
||||
@@ -48,7 +48,7 @@ export class Post extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Post
|
||||
*/
|
||||
public viewCount: number;
|
||||
public viewCount: number
|
||||
|
||||
/**
|
||||
* The text of post
|
||||
@@ -56,7 +56,7 @@ export class Post extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Post
|
||||
*/
|
||||
public body: string;
|
||||
public body: string
|
||||
|
||||
/**
|
||||
* The identifier of post owner
|
||||
@@ -64,7 +64,7 @@ export class Post extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Post
|
||||
*/
|
||||
public ownerUserId: string;
|
||||
public ownerUserId: string
|
||||
|
||||
/**
|
||||
* Full name of post owner
|
||||
@@ -72,7 +72,7 @@ export class Post extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Post
|
||||
*/
|
||||
public ownerDisplayName: string;
|
||||
public ownerDisplayName: string
|
||||
|
||||
/**
|
||||
* Avatar address of post owner
|
||||
@@ -80,7 +80,7 @@ export class Post extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Post
|
||||
*/
|
||||
public ownerAvatar: string;
|
||||
public ownerAvatar: string
|
||||
|
||||
/**
|
||||
* Last post edit date
|
||||
@@ -88,7 +88,7 @@ export class Post extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Post
|
||||
*/
|
||||
public lastEditDate: number;
|
||||
public lastEditDate: number
|
||||
|
||||
/**
|
||||
* Post tags
|
||||
@@ -96,7 +96,7 @@ export class Post extends BaseDomain {
|
||||
* @type {string[]}
|
||||
* @memberof Post
|
||||
*/
|
||||
public tags: string[];
|
||||
public tags: string[]
|
||||
|
||||
/**
|
||||
* Numeber of comment on the post
|
||||
@@ -104,7 +104,7 @@ export class Post extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Post
|
||||
*/
|
||||
public commentCounter: number;
|
||||
public commentCounter: number
|
||||
|
||||
/**
|
||||
* The address of image on the post
|
||||
@@ -112,7 +112,7 @@ export class Post extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Post
|
||||
*/
|
||||
public image: string;
|
||||
public image: string
|
||||
|
||||
/**
|
||||
* Post image full path
|
||||
@@ -120,7 +120,7 @@ export class Post extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Post
|
||||
*/
|
||||
public imageFullPath: string;
|
||||
public imageFullPath: string
|
||||
|
||||
/**
|
||||
* The adress of video on the post
|
||||
@@ -128,7 +128,7 @@ export class Post extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Post
|
||||
*/
|
||||
public video: string;
|
||||
public video: string
|
||||
|
||||
/**
|
||||
* If writing comment is disabled {true} or not {false}
|
||||
@@ -136,7 +136,7 @@ export class Post extends BaseDomain {
|
||||
* @type {Boolean}
|
||||
* @memberof Post
|
||||
*/
|
||||
public disableComments: Boolean;
|
||||
public disableComments: Boolean
|
||||
|
||||
/**
|
||||
* If sharing post is disabled {true} or not {false}
|
||||
@@ -144,7 +144,7 @@ export class Post extends BaseDomain {
|
||||
* @type {Boolean}
|
||||
* @memberof Post
|
||||
*/
|
||||
public disableSharing: Boolean;
|
||||
public disableSharing: Boolean
|
||||
|
||||
/**
|
||||
* If the post is deleted {true} or not false
|
||||
@@ -152,7 +152,7 @@ export class Post extends BaseDomain {
|
||||
* @type {Boolean}
|
||||
* @memberof Post
|
||||
*/
|
||||
public deleted: Boolean;
|
||||
public deleted: Boolean
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import {User} from './user';
|
||||
import {Profile} from './profile';
|
||||
import {User} from './user'
|
||||
import {Profile} from './profile'
|
||||
|
||||
export {
|
||||
User,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseDomain } from "domain/common";
|
||||
import { BaseDomain } from 'domain/common'
|
||||
|
||||
export class Profile extends BaseDomain {
|
||||
|
||||
@@ -8,7 +8,7 @@ export class Profile extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Profile
|
||||
*/
|
||||
public avatar: string;
|
||||
public avatar: string
|
||||
|
||||
/**
|
||||
* User email
|
||||
@@ -16,7 +16,7 @@ export class Profile extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Profile
|
||||
*/
|
||||
public email: string;
|
||||
public email: string
|
||||
|
||||
/**
|
||||
* User full name
|
||||
@@ -24,7 +24,7 @@ export class Profile extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Profile
|
||||
*/
|
||||
public fullName: string;
|
||||
public fullName: string
|
||||
|
||||
/**
|
||||
* The banner address of user profile
|
||||
@@ -32,7 +32,7 @@ export class Profile extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Profile
|
||||
*/
|
||||
public banner: string;
|
||||
public banner: string
|
||||
|
||||
/**
|
||||
* User tag line
|
||||
@@ -40,6 +40,6 @@ export class Profile extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Profile
|
||||
*/
|
||||
public tagLine: string;
|
||||
public tagLine: string
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseDomain } from "domain/common";
|
||||
import { BaseDomain } from 'domain/common'
|
||||
|
||||
export class User extends BaseDomain {
|
||||
|
||||
@@ -8,7 +8,7 @@ export class User extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
public fullName: string;
|
||||
public fullName: string
|
||||
|
||||
/**
|
||||
* User avatar address
|
||||
@@ -16,7 +16,7 @@ export class User extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
public avatar: string;
|
||||
public avatar: string
|
||||
|
||||
/**
|
||||
* Email of the user
|
||||
@@ -24,7 +24,7 @@ export class User extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
public email?: string | null;
|
||||
public email?: string | null
|
||||
|
||||
/**
|
||||
* Password of the user
|
||||
@@ -32,7 +32,7 @@ export class User extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
public password?: string | null;
|
||||
public password?: string | null
|
||||
|
||||
/**
|
||||
* User identifier
|
||||
@@ -40,7 +40,7 @@ export class User extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
public userId?: string | null;
|
||||
public userId?: string | null
|
||||
|
||||
/**
|
||||
* User creation date
|
||||
@@ -48,6 +48,6 @@ export class User extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof User
|
||||
*/
|
||||
public creationDate: number;
|
||||
public creationDate: number
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Vote} from './vote';
|
||||
import {Vote} from './vote'
|
||||
|
||||
export {
|
||||
Vote
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseDomain } from "domain/common";
|
||||
import { BaseDomain } from 'domain/common'
|
||||
|
||||
export class Vote extends BaseDomain {
|
||||
|
||||
@@ -8,7 +8,7 @@ export class Vote extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Vote
|
||||
*/
|
||||
public id?: string | null;
|
||||
public id?: string | null
|
||||
|
||||
/**
|
||||
* Post identifire which vote on
|
||||
@@ -16,7 +16,7 @@ export class Vote extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Vote
|
||||
*/
|
||||
public postId: string;
|
||||
public postId: string
|
||||
|
||||
/**
|
||||
* Vote date
|
||||
@@ -24,7 +24,7 @@ export class Vote extends BaseDomain {
|
||||
* @type {number}
|
||||
* @memberof Vote
|
||||
*/
|
||||
public creationDate: number;
|
||||
public creationDate: number
|
||||
|
||||
/**
|
||||
* Voter full name
|
||||
@@ -32,7 +32,7 @@ export class Vote extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Vote
|
||||
*/
|
||||
public userDisplayName: string;
|
||||
public userDisplayName: string
|
||||
|
||||
/**
|
||||
* Avatar of voter
|
||||
@@ -40,7 +40,7 @@ export class Vote extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Vote
|
||||
*/
|
||||
public userAvatar: string;
|
||||
public userAvatar: string
|
||||
|
||||
/**
|
||||
* Voter identifier
|
||||
@@ -48,6 +48,6 @@ export class Vote extends BaseDomain {
|
||||
* @type {string}
|
||||
* @memberof Vote
|
||||
*/
|
||||
public userId: string;
|
||||
public userId: string
|
||||
|
||||
}
|
||||
@@ -5,6 +5,6 @@ export interface IServiceProvider{
|
||||
*
|
||||
* @memberof IServiceProvider
|
||||
*/
|
||||
createAuthorizeService : () => IAuthorizeService;
|
||||
createAuthorizeService : () => IAuthorizeService
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IServiceProvider } from "./IServiceProvider";
|
||||
import { ServiceProvide } from "./serviceProvide";
|
||||
import { IServiceProvider } from './IServiceProvider'
|
||||
import { ServiceProvide } from './serviceProvide'
|
||||
|
||||
export {
|
||||
IServiceProvider,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
//#region Interfaces
|
||||
|
||||
import { IServiceProvider } from "factories";
|
||||
import { IAuthorizeService } from "services/authorize";
|
||||
import { IServiceProvider } from 'factories'
|
||||
import { IAuthorizeService } from 'services/authorize'
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Service implemented classes
|
||||
|
||||
// - Firebase services
|
||||
import { AuthorizeService } from "firebaseServices/authorize";
|
||||
import { AuthorizeService } from 'firebaseServices/authorize'
|
||||
|
||||
//#endregion
|
||||
|
||||
@@ -20,7 +20,7 @@ export class ServiceProvide implements IServiceProvider {
|
||||
* @memberof ServiceProvide
|
||||
*/
|
||||
createAuthorizeService: () => IAuthorizeService = () => {
|
||||
return new AuthorizeService();
|
||||
return new AuthorizeService()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import firebase from 'firebase';
|
||||
import firebase from 'firebase'
|
||||
|
||||
try {
|
||||
var config = {
|
||||
let config = {
|
||||
apiKey: process.env.API_KEY,
|
||||
authDomain: process.env.AUTH_DOMAIN,
|
||||
databaseURL: process.env.DATABASE_URL,
|
||||
@@ -10,17 +10,17 @@ try {
|
||||
messagingSenderId: process.env.MESSAGING_SENDER_ID
|
||||
}
|
||||
|
||||
firebase.initializeApp(config);
|
||||
firebase.initializeApp(config)
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
// - Storage reference
|
||||
export var storageRef = firebase.storage().ref()
|
||||
export let storageRef = firebase.storage().ref()
|
||||
|
||||
// - Database authorize
|
||||
export var firebaseAuth = firebase.auth
|
||||
export var firebaseRef = firebase.database().ref()
|
||||
export let firebaseAuth = firebase.auth
|
||||
export let firebaseRef = firebase.database().ref()
|
||||
|
||||
// - Firebase default
|
||||
export default firebase;
|
||||
export default firebase
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// - Import react components
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/';
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/'
|
||||
|
||||
import { IAuthorizeService } from "services/authorize";
|
||||
import { User } from "Domain/users";
|
||||
import { LoginUser, RegisterUserResult } from "domain/authorize";
|
||||
import { SocialError } from "domain/common";
|
||||
import { IAuthorizeService } from 'services/authorize'
|
||||
import { User } from 'Domain/users'
|
||||
import { LoginUser, RegisterUserResult } from 'domain/authorize'
|
||||
import { SocialError } from 'domain/common'
|
||||
|
||||
/**
|
||||
* Firbase authorize service
|
||||
*
|
||||
*
|
||||
* @export
|
||||
* @class AuthorizeService
|
||||
* @implements {IAuthorizeService}
|
||||
@@ -17,45 +17,45 @@ export class AuthorizeService implements IAuthorizeService {
|
||||
|
||||
/**
|
||||
* Login the user
|
||||
*
|
||||
*
|
||||
* @returns {Promise<LoginUser>}
|
||||
* @memberof IAuthorizeService
|
||||
*/
|
||||
public login: (email: string, password: string) => Promise<LoginUser> = (email, password) => {
|
||||
public login: (email: string, password: string) => Promise<LoginUser> = (email, password) => {
|
||||
|
||||
return new Promise<LoginUser>((resolve, reject) => {
|
||||
firebaseAuth()
|
||||
return new Promise<LoginUser>((resolve, reject) => {
|
||||
firebaseAuth()
|
||||
.signInWithEmailAndPassword(email, password)
|
||||
.then((result) => {
|
||||
resolve(new LoginUser(result.uid));
|
||||
resolve(new LoginUser(result.uid))
|
||||
})
|
||||
.catch((error: any) => {
|
||||
reject(new SocialError(error.code, error.message));
|
||||
reject(new SocialError(error.code, error.message))
|
||||
})
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out the user
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
* @memberof IAuthorizeService
|
||||
*/
|
||||
* Logs out the user
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
* @memberof IAuthorizeService
|
||||
*/
|
||||
public logout: () => Promise<void> = () => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
firebaseAuth()
|
||||
.signOut()
|
||||
.then((result) => {
|
||||
resolve();
|
||||
resolve()
|
||||
})
|
||||
.catch((error: any) => {
|
||||
|
||||
reject(new SocialError(error.code, error.message));
|
||||
reject(new SocialError(error.code, error.message))
|
||||
})
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Register a user
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
@@ -64,49 +64,48 @@ export class AuthorizeService implements IAuthorizeService {
|
||||
public registerUser: (user: User) => Promise<RegisterUserResult> = (user) => {
|
||||
return new Promise<RegisterUserResult>((resolve, reject) => {
|
||||
firebaseAuth()
|
||||
.createUserWithEmailAndPassword(user.email, user.password)
|
||||
.createUserWithEmailAndPassword(user.email as string, user.password as string)
|
||||
.then((signupResult) => {
|
||||
firebaseRef.child(`users/${signupResult.uid}/info`)
|
||||
.set({
|
||||
...user,
|
||||
avatar: 'noImage'
|
||||
avatar: 'noImage'
|
||||
})
|
||||
.then((result) => {
|
||||
resolve(new RegisterUserResult(signupResult.uid));
|
||||
resolve(new RegisterUserResult(signupResult.uid))
|
||||
})
|
||||
.catch((error: any) => reject(new SocialError(error.name, error.message)));
|
||||
.catch((error: any) => reject(new SocialError(error.name, error.message)))
|
||||
})
|
||||
.catch((error: any) => reject(new SocialError(error.code, error.message)));
|
||||
});
|
||||
.catch((error: any) => reject(new SocialError(error.code, error.message)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Update user password
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
* @memberof IAuthorizeService
|
||||
*/
|
||||
public updatePassword: (newPassword: string) => Promise<void> = (newPassword) => {
|
||||
console.log('====================================');
|
||||
console.log("update password");
|
||||
console.log('====================================');
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
var user = firebaseAuth().currentUser;
|
||||
console.log('====================================');
|
||||
console.log(user);
|
||||
console.log('====================================');
|
||||
if (user) {
|
||||
user.updatePassword(newPassword).then(() => {
|
||||
// Update successful.
|
||||
resolve();
|
||||
}).catch((error: any) => {
|
||||
// An error happened.
|
||||
reject(new SocialError(error.code, error.message));
|
||||
});
|
||||
}
|
||||
public updatePassword: (newPassword: string) => Promise<void> = (newPassword) => {
|
||||
console.log('====================================')
|
||||
console.log('update password')
|
||||
console.log('====================================')
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let user = firebaseAuth().currentUser
|
||||
console.log('====================================')
|
||||
console.log(user)
|
||||
console.log('====================================')
|
||||
if (user) {
|
||||
user.updatePassword(newPassword).then(() => {
|
||||
// Update successful.
|
||||
resolve()
|
||||
}).catch((error: any) => {
|
||||
// An error happened.
|
||||
reject(new SocialError(error.code, error.message))
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AuthorizeService } from "./AuthorizeService";
|
||||
import { AuthorizeService } from './AuthorizeService'
|
||||
|
||||
export {
|
||||
AuthorizeService
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// - Import react components
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/';
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/'
|
||||
|
||||
|
||||
import { SocialError } from "domain/common";
|
||||
import { ICircleService } from 'services/circles';
|
||||
import { Circle, UserFollower } from 'domain/circles';
|
||||
import { User } from 'domain/users';
|
||||
import { SocialError } from 'domain/common'
|
||||
import { ICircleService } from 'services/circles'
|
||||
import { Circle, UserFollower } from 'domain/circles'
|
||||
import { User } from 'domain/users'
|
||||
|
||||
/**
|
||||
* Firbase circle service
|
||||
@@ -16,12 +16,12 @@ import { User } from 'domain/users';
|
||||
*/
|
||||
export class CircleService implements ICircleService {
|
||||
|
||||
addCircle: (userId: string, circle: Circle) => Promise<string>;
|
||||
addFollowingUser: (userId: string, circleId: string, userCircle: User, userFollower: UserFollower, userFollowingId: string) => Promise<void>;
|
||||
deleteFollowingUser: (userId: string, circleId: string, userFollowingId: string) => Promise<void>;
|
||||
updateCircle: (userId: string, circle: Circle, circleId: string) => Promise<void>;
|
||||
deleteCircle: (circleId: string, userId: string) => Promise<void>;
|
||||
getCircles: () => Promise<{ [circleId: string]: Circle; }>;
|
||||
getCirclesByUserId: (userId: string) => Promise<{ [circleId: string]: Circle; }>;
|
||||
addCircle: (userId: string, circle: Circle) => Promise<string>
|
||||
addFollowingUser: (userId: string, circleId: string, userCircle: User, userFollower: UserFollower, userFollowingId: string) => Promise<void>
|
||||
deleteFollowingUser: (userId: string, circleId: string, userFollowingId: string) => Promise<void>
|
||||
updateCircle: (userId: string, circle: Circle, circleId: string) => Promise<void>
|
||||
deleteCircle: (circleId: string, userId: string) => Promise<void>
|
||||
getCircles: () => Promise<{ [circleId: string]: Circle }>
|
||||
getCirclesByUserId: (userId: string) => Promise<{ [circleId: string]: Circle }>
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AuthorizeService } from "./CircleService";
|
||||
import { AuthorizeService } from './CircleService'
|
||||
|
||||
export {
|
||||
AuthorizeService
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// - Import react components
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/';
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/'
|
||||
|
||||
import { SocialError } from "domain/common";
|
||||
import { ICommentService } from 'services/comments';
|
||||
import { SocialError } from 'domain/common'
|
||||
import { ICommentService } from 'services/comments'
|
||||
|
||||
/**
|
||||
* Firbase comment service
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CommentService } from "./CommentService";
|
||||
import { CommentService } from './CommentService'
|
||||
|
||||
export {
|
||||
CommentService
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// - Import react components
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/';
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/'
|
||||
|
||||
import { SocialError } from "domain/common";
|
||||
import { ICommonService } from 'services/common';
|
||||
import { SocialError } from 'domain/common'
|
||||
import { ICommonService } from 'services/common'
|
||||
|
||||
/**
|
||||
* Firbase common service
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CommonService } from "./CommonService";
|
||||
import { CommonService } from './CommonService'
|
||||
|
||||
export {
|
||||
CommonService
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// - Import react components
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/';
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/'
|
||||
|
||||
import { SocialError } from "domain/common";
|
||||
import { IImageGalleryService } from 'services/imageGallery';
|
||||
import { SocialError } from 'domain/common'
|
||||
import { IImageGalleryService } from 'services/imageGallery'
|
||||
|
||||
/**
|
||||
* Firbase image gallery service
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ImageGalleryService } from "./ImageGalleryService";
|
||||
import { ImageGalleryService } from './ImageGalleryService'
|
||||
|
||||
export {
|
||||
ImageGalleryService
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NotificationService } from "./NotificationService";
|
||||
import { NotificationService } from './NotificationService'
|
||||
|
||||
export {
|
||||
NotificationService
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// - Import react components
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/';
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/'
|
||||
|
||||
import { SocialError } from "domain/common";
|
||||
import { INotificationService } from 'services/notifications';
|
||||
import { SocialError } from 'domain/common'
|
||||
import { INotificationService } from 'services/notifications'
|
||||
|
||||
/**
|
||||
* Firbase notification service
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// - Import react components
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/';
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/'
|
||||
|
||||
import { SocialError } from "domain/common";
|
||||
import { IPostService } from 'services/posts';
|
||||
import { SocialError } from 'domain/common'
|
||||
import { IPostService } from 'services/posts'
|
||||
|
||||
/**
|
||||
* Firbase post service
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PostService } from "./PostService";
|
||||
import { PostService } from './PostService'
|
||||
|
||||
export {
|
||||
PostService
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// - Import react components
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/';
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/'
|
||||
|
||||
import { SocialError } from "domain/common";
|
||||
import { IUserService } from 'services/users';
|
||||
import { SocialError } from 'domain/common'
|
||||
import { IUserService } from 'services/users'
|
||||
|
||||
/**
|
||||
* Firbase user service
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UserService } from "./UserService";
|
||||
import { UserService } from './UserService'
|
||||
|
||||
export {
|
||||
UserService
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// - Import react components
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/';
|
||||
import { firebaseRef, firebaseAuth } from 'app/firebase/'
|
||||
|
||||
import { SocialError } from "domain/common";
|
||||
import { IVoteService } from 'services/votes';
|
||||
import { SocialError } from 'domain/common'
|
||||
import { IVoteService } from 'services/votes'
|
||||
|
||||
/**
|
||||
* Firbase vote service
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { VoteService } from "./VoteService";
|
||||
import { VoteService } from './VoteService'
|
||||
|
||||
export {
|
||||
VoteService
|
||||
|
||||
@@ -63,7 +63,7 @@ export default class DialogTitle extends Component {
|
||||
contain: {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
justifyContent: "space-between"
|
||||
justifyContent: 'space-between'
|
||||
},
|
||||
title: {
|
||||
color: 'rgba(0,0,0,0.87)',
|
||||
|
||||
@@ -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}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user