mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
Switching displayname update to account endpoint.
This commit is contained in:
@@ -15,11 +15,11 @@ export const hideCreateDisplayNameDialog = () => ({type: actions.HIDE_CREATEDISP
|
||||
const createDisplayNameSuccess = () => ({type: actions.CREATEDISPLAYNAME_SUCCESS});
|
||||
const createDisplayNameFailure = error => ({type: actions.CREATEDISPLAYNAME_FAILURE, error});
|
||||
|
||||
export const updateDisplayName = displayName => ({type: actions.UPDATE_DISPLAYNAME, displayName});
|
||||
export const updateDisplayName = ({displayName}) => ({type: actions.UPDATE_DISPLAYNAME, displayName});
|
||||
|
||||
export const createDisplayName = (userId, formData) => dispatch => {
|
||||
dispatch(createDisplayNameRequest());
|
||||
coralApi('account/displayname', {method: 'PUT', body: formData})
|
||||
coralApi('/account/displayname', {method: 'PUT', body: formData})
|
||||
.then(() => {
|
||||
dispatch(createDisplayNameSuccess());
|
||||
dispatch(hideCreateDisplayNameDialog());
|
||||
|
||||
@@ -11,6 +11,9 @@ function getQueryVariable(variable) {
|
||||
return decodeURIComponent(pair[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// If no query is included, return a default string for development
|
||||
return 'http://dev.default.stream';
|
||||
}
|
||||
|
||||
export const queryStream = graphql(STREAM_QUERY, {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Map} from 'immutable';
|
||||
import {Map, fromJS} from 'immutable';
|
||||
import * as actions from '../constants/auth';
|
||||
|
||||
const initialState = Map({
|
||||
@@ -21,7 +21,7 @@ const initialState = Map({
|
||||
|
||||
const purge = user => {
|
||||
const {settings, profiles, ...userData} = user; // eslint-disable-line
|
||||
return userData;
|
||||
return fromJS(userData);
|
||||
};
|
||||
|
||||
export default function auth (state = initialState, action) {
|
||||
@@ -131,8 +131,9 @@ export default function auth (state = initialState, action) {
|
||||
.set('passwordRequestFailure', 'There was an error sending your password reset email. Please try again soon!')
|
||||
.set('passwordRequestSuccess', null);
|
||||
case actions.UPDATE_DISPLAYNAME:
|
||||
console.log('Action', action);
|
||||
return state
|
||||
.set('user', purge(action.displayName));
|
||||
.setIn(['user', 'displayName'], action.displayName);
|
||||
case actions.EMAIL_CONFIRM_ERROR:
|
||||
return state
|
||||
.set('emailConfirmationFailure', true)
|
||||
|
||||
Reference in New Issue
Block a user