WIP Подключил store для мед карты, поправил форму Основных данных

This commit is contained in:
DwCay
2023-04-03 18:36:27 +03:00
parent dbf05561d7
commit 8572247851
5 changed files with 71 additions and 19 deletions

View File

@@ -1,15 +1,8 @@
import { createStore } from "vuex";
import medical from "./modules/medicalCard";
export default createStore({
state: {
currentPatient: {},
test: "Привет",
modules: {
medical,
},
mutations: {
setCurrentPatient(state, patient) {
state.currentPatient = patient;
},
},
actions: {},
modules: {},
});

View File

@@ -0,0 +1,32 @@
import { fetchWrapper } from "@/shared/fetchWrapper";
const state = () => ({
medicalCard: {},
});
const getters = {};
const actions = {
getMedicalCardData({ commit }) {
fetchWrapper
.get(
`medical_card/medical_history/${localStorage.getItem(
"medicalId"
)}/detail/`
)
.then((res) => commit("setMedicalCard", res));
},
};
const mutations = {
setMedicalCard(state, card) {
state.medicalCard = card;
},
};
export default {
state,
getters,
actions,
mutations,
};