Commiting
This commit is contained in:
@@ -11,52 +11,50 @@ export const SAVE_USER_PROFILE_INFORMATION_FETCH_SUCCESS = 'SAVE_USER_PROFILE_IN
|
||||
export const SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL = 'SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL'
|
||||
export const RESEND_USER_CONFIRMATION_EMAIL_SUCCESS = 'RESEND_USER_CONFIRMATION_EMAIL_SUCCESS'
|
||||
|
||||
export const saveUserProfileInformation = (data) => {
|
||||
return function (dispatch, getState) {
|
||||
if (!isObject(data) || !me) return
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export const saveUserProfileInformation = (data) => (dispatch, getState) => {
|
||||
if (!isObject(data) || !me) return
|
||||
|
||||
dispatch(saveUserProfileInformationRequest())
|
||||
dispatch(saveUserProfileInformationRequest())
|
||||
|
||||
const formData = new FormData()
|
||||
if (!!data.displayName) formData.append('display_name', data.displayName)
|
||||
if (data.note !== undefined) formData.append('note', data.note)
|
||||
if (data.avatar !== undefined) formData.append('avatar', data.avatar)
|
||||
if (data.header !== undefined) formData.append('header', data.header)
|
||||
if (data.locked !== undefined) formData.append('locked', data.locked)
|
||||
const formData = new FormData()
|
||||
if (!!data.displayName) formData.append('display_name', data.displayName)
|
||||
if (data.note !== undefined) formData.append('note', data.note)
|
||||
if (data.avatar !== undefined) formData.append('avatar', data.avatar)
|
||||
if (data.header !== undefined) formData.append('header', data.header)
|
||||
if (data.locked !== undefined) formData.append('locked', data.locked)
|
||||
|
||||
api(getState).patch('/api/v1/accounts/update_credentials', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}).then((response) => {
|
||||
dispatch(importFetchedAccount(response.data))
|
||||
dispatch(saveUserProfileInformationSuccess(response.data))
|
||||
}).catch(error => {
|
||||
dispatch(saveUserProfileInformationFail(error))
|
||||
})
|
||||
}
|
||||
api(getState).patch('/api/v1/accounts/update_credentials', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}).then((response) => {
|
||||
dispatch(importFetchedAccount(response.data))
|
||||
dispatch(saveUserProfileInformationSuccess(response.data))
|
||||
}).catch((error) => {
|
||||
dispatch(saveUserProfileInformationFail(error))
|
||||
})
|
||||
}
|
||||
|
||||
function saveUserProfileInformationRequest() {
|
||||
return {
|
||||
type: SAVE_USER_PROFILE_INFORMATION_FETCH_REQUEST,
|
||||
}
|
||||
}
|
||||
const saveUserProfileInformationRequest = () => ({
|
||||
type: SAVE_USER_PROFILE_INFORMATION_FETCH_REQUEST,
|
||||
})
|
||||
|
||||
function saveUserProfileInformationSuccess(userProfileData) {
|
||||
return {
|
||||
type: SAVE_USER_PROFILE_INFORMATION_FETCH_SUCCESS,
|
||||
userProfileData,
|
||||
}
|
||||
}
|
||||
const saveUserProfileInformationSuccess = (userProfileData) => ({
|
||||
type: SAVE_USER_PROFILE_INFORMATION_FETCH_SUCCESS,
|
||||
userProfileData,
|
||||
})
|
||||
|
||||
function saveUserProfileInformationFail(error) {
|
||||
return {
|
||||
type: SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL,
|
||||
error,
|
||||
}
|
||||
}
|
||||
const saveUserProfileInformationFail = (error) => ({
|
||||
type: SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL,
|
||||
error,
|
||||
})
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export const resendUserConfirmationEmail = () => (dispatch, getState) => {
|
||||
if (!me || emailConfirmed) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user