mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-31 21:51:10 -04:00
add avatar on account-settings
This commit is contained in:
@ -12,11 +12,7 @@ export const loadData = ({ commit, dispatch, state }, id) => {
|
||||
|
||||
export const editCompany = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post('/api/settings/company', data, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}).then((response) => {
|
||||
window.axios.post('/api/settings/company', data).then((response) => {
|
||||
// commit(types.UPDATE_ITEM, response.data)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
// import * as types from './mutation-types'
|
||||
import * as types from './mutation-types'
|
||||
|
||||
export const loadData = ({ commit, dispatch, state }, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.get(`/api/settings/profile`).then((response) => {
|
||||
commit(types.SET_USER, response.data)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
@ -13,7 +14,29 @@ export const loadData = ({ commit, dispatch, state }, id) => {
|
||||
export const editUser = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.put('/api/settings/profile', data).then((response) => {
|
||||
// commit(types.UPDATE_USER, response.data)
|
||||
commit(types.UPDATE_USER, response.data)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const uploadOnboardAvatar = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/admin/profile/upload-avatar`, data).then((response) => {
|
||||
commit(types.UPDATE_USER, response.data.user)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const uploadAvatar = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post('/api/settings/profile/upload-avatar', data).then((response) => {
|
||||
commit(types.UPDATE_USER, response.data.user)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
export const SET_USER = 'SET_USER'
|
||||
export const UPDATE_USER = 'UPDATE_USER'
|
||||
export const UPDATE_USER_AVATAR = 'UPDATE_USER_AVATAR'
|
||||
|
||||
@ -2,10 +2,14 @@ import * as types from './mutation-types'
|
||||
|
||||
export default {
|
||||
[types.SET_USER] (state, data) {
|
||||
state.user = data.user
|
||||
state.user = data
|
||||
},
|
||||
|
||||
[types.UPDATE_USER] (state, data) {
|
||||
state.user = data
|
||||
},
|
||||
|
||||
[types.UPDATE_USER_AVATAR] (state, data) {
|
||||
state.user.avatar = data.avatar
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user