feat(privacy): Add privacy settings
This commit is contained in:
@@ -24,7 +24,8 @@ export const types = createTypes(
|
||||
...createAsyncTypes('validateUsername'),
|
||||
...createAsyncTypes('submitNewAbout'),
|
||||
...createAsyncTypes('submitNewUsername'),
|
||||
...createAsyncTypes('updateUserFlag')
|
||||
...createAsyncTypes('updateUserFlag'),
|
||||
...createAsyncTypes('submitProfileUI')
|
||||
],
|
||||
ns
|
||||
);
|
||||
@@ -49,6 +50,13 @@ export const submitNewUsernameError = createAction(
|
||||
types.submitNewUsernameError
|
||||
);
|
||||
|
||||
export const submitProfileUI = createAction(types.submitProfileUI);
|
||||
export const submitProfileUIComplete = createAction(
|
||||
types.submitProfileUIComplete,
|
||||
checkForSuccessPayload
|
||||
);
|
||||
export const submitProfileUIError = createAction(types.submitProfileUIError);
|
||||
|
||||
export const updateUserFlag = createAction(types.updateUserFlag);
|
||||
export const updateUserFlagComplete = createAction(
|
||||
types.updateUserFlagComplete,
|
||||
|
@@ -9,11 +9,14 @@ import {
|
||||
submitNewAboutComplete,
|
||||
submitNewAboutError,
|
||||
submitNewUsernameComplete,
|
||||
submitNewUsernameError
|
||||
submitNewUsernameError,
|
||||
submitProfileUIComplete,
|
||||
submitProfileUIError
|
||||
} from './';
|
||||
import {
|
||||
getUsernameExists,
|
||||
putUpdateMyAbout,
|
||||
putUpdateMyProfileUI,
|
||||
putUpdateMyUsername,
|
||||
putUpdateUserFlag
|
||||
} from '../../utils/ajax';
|
||||
@@ -39,6 +42,16 @@ function* submitNewUsernameSaga({ payload: username }) {
|
||||
}
|
||||
}
|
||||
|
||||
function* sumbitProfileUISaga({ payload }) {
|
||||
try {
|
||||
const { data: response } = yield call(putUpdateMyProfileUI, payload);
|
||||
yield put(submitProfileUIComplete({ ...response, payload }));
|
||||
yield put(createFlashMessage(response));
|
||||
} catch (e) {
|
||||
yield put(submitProfileUIError);
|
||||
}
|
||||
}
|
||||
|
||||
function* updateUserFlagSaga({ payload: update }) {
|
||||
try {
|
||||
const { data: response } = yield call(putUpdateUserFlag, update);
|
||||
@@ -66,6 +79,7 @@ export function createSettingsSagas(types) {
|
||||
takeEvery(types.updateUserFlag, updateUserFlagSaga),
|
||||
takeLatest(types.submitNewAbout, submitNewAboutSaga),
|
||||
takeLatest(types.submitNewUsername, submitNewUsernameSaga),
|
||||
takeLatest(types.validateUsername, validateUsernameSaga)
|
||||
takeLatest(types.validateUsername, validateUsernameSaga),
|
||||
takeLatest(types.submitProfileUI, sumbitProfileUISaga)
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user