Ionic Firestore更新权限被拒绝

时间:2018-12-16 20:01:10

标签: angular firebase ionic-framework google-cloud-firestore ngrx-effects

我尝试更新Firestore集合的内容,但出现错误消息“ zone.js:665未处理的承诺拒绝:PERMISSION_DENIED:权限被拒绝;区域:;任务:WebSocket.addEventListener:消息;值:错误:PERMISSION_DENIED :权限被拒绝”

我的Firestore设置为

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth.uid != null;
    }
    
    match /subscriptions/{subscription} {
      allow read: if true;
      allow write: if true;
    }
  }
}

我的Ngrx效果是

    @Effect()
    updateCurrentUser: Observable<Action> = this.actions.ofType(currentUserActions.UPDATE_CURRENT_USER)
        .pipe(map((action: currentUserActions.UpdateCurrentUser) => { action.payload   }))
        .pipe(mergeMap(payload => of(this.db.object(`profiles/${this.currentUserID}`)
                                    .update({
                                        age: "29",
                                        displayName: "JOHN PAPA",
                                        photoURL: "https://graph.facebook.com/5555555555555555/picture?type=large",
                                    })
        )))
        .pipe(map(() => { 
            return new currentUserActions.UpdateCurrentUserSuccess() }))
        .pipe(catchError(err => of (new currentUserActions.UpdateCurrentUserFail())))

感谢我的帮助

0 个答案:

没有答案