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))
|
||||
|
||||
Reference in New Issue
Block a user