如何从后端重新加载数据以更新保存在 ngrx store 中的数据

问题描述 投票:0回答:0

我有一个效果,在启动应用的时候保存用户的个人资料,但是我需要从后端再次请求它来更新它

loadProfile$ = createEffect(() =>
this.actions$.pipe(
  ofType(fromProfileActions.loadProfile),
  switchMap(() =>
    this.profileService.getProfile().pipe(
      map((res: any) => {
        return fromProfileActions.loadProfileSuccess({
          profile: res,
        });
      }),
      catchError((error) => {
        return of(
          fromProfileActions.loadProfileFail({
            error,
          })
        );
      })
    )
  )
)

);

如何通过再次向服务器发出相同的请求来更新已保存的数据? 我试图在删除保存的数据后发送动作负载配置文件但不起作用

angular ngrx ngrx-effects
© www.soinside.com 2019 - 2024. All rights reserved.