Flatten nested repos
This commit is contained in:
1268
test/vuex/cpone-masterdata-patient/modules/patient.js
Normal file
1268
test/vuex/cpone-masterdata-patient/modules/patient.js
Normal file
File diff suppressed because it is too large
Load Diff
50
test/vuex/cpone-masterdata-patient/modules/photo.js
Normal file
50
test/vuex/cpone-masterdata-patient/modules/photo.js
Normal file
@@ -0,0 +1,50 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/photo.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
dialog_photo: false,
|
||||
photo_64: '',
|
||||
photo_url: './blank-profile.png',
|
||||
default_photo_url: './blank-profile.png',
|
||||
patient_id: 0
|
||||
},
|
||||
mutations: {
|
||||
update_dialog_photo (state, v) {
|
||||
state.dialog_photo = v
|
||||
},
|
||||
|
||||
update_photo_64 (state, data) {
|
||||
state.photo_64 = data
|
||||
},
|
||||
|
||||
update_photo_url (state, data) {
|
||||
state.photo_url = data
|
||||
},
|
||||
|
||||
update_patient_id (state, id) {
|
||||
state.patient_id = id
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async upload(context) {
|
||||
|
||||
try {
|
||||
let resp = await api.upload(one_token(), context.state.patient_id, context.state.photo_64)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
} else {
|
||||
context.commit('update_photo_url', resp.data.photo_url);
|
||||
context.commit('update_dialog_photo', false)
|
||||
}
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user