Example #1
0
        public static object editPersonalInfo(string fullName, string title, string jobRoleId, string placeId)
        {
            return(new ThunkAction <AppState>((dispatcher, getState) => {
                var userId = getState().loginState.loginInfo.userId ?? "";
                return UserApi.EditPersonalInfo(userId: userId, fullName: fullName, title: title, jobRoleId: jobRoleId,
                                                placeId: placeId)
                .Then(editPersonalInfoResponse => {
                    if (editPersonalInfoResponse.placeMap != null)
                    {
                        dispatcher.dispatch(new PlaceMapAction {
                            placeMap = editPersonalInfoResponse.placeMap
                        });
                    }

                    dispatcher.dispatch(new EditPersonalInfoSuccessAction {
                        user = editPersonalInfoResponse.user
                    });
                    var oldLoginInfo = getState().loginState.loginInfo;
                    var loginInfo = new LoginInfo {
                        LSKey = oldLoginInfo.LSKey,
                        userId = oldLoginInfo.userId,
                        userFullName = editPersonalInfoResponse.user.fullName,
                        userAvatar = editPersonalInfoResponse.user.avatar,
                        authId = oldLoginInfo.authId,
                        anonymous = oldLoginInfo.anonymous,
                        title = editPersonalInfoResponse.user.title,
                        coverImageWithCDN = editPersonalInfoResponse.user.coverImage
                    };
                    UserInfoManager.saveUserInfo(loginInfo: loginInfo);
                });
            }));
        }