Добавил параметры роута

This commit is contained in:
megavrilinvv
2023-08-15 19:55:44 +03:00
parent c49b4ad050
commit 53adfc204b
3 changed files with 10 additions and 1 deletions

View File

@@ -50,6 +50,10 @@ export default {
created() {
if (!localStorage.getItem("medicalId")) this.$router.push("/calendar");
this.$store.dispatch("getMedicalCardData");
this.$router.push({
name: "medical",
params: { id: localStorage.getItem("medicalCardId") },
});
},
};
</script>

View File

@@ -41,7 +41,11 @@ export default createRouter({
{ path: "clients", component: TheUser },
{ path: "medcards", component: TheMedcards },
{ path: "settings", component: TheSettings },
{ path: "medical-card", component: TheMedicalCard },
{
name: "medical",
path: "medical-card/:id?",
component: TheMedicalCard,
},
{ path: "create-medical-card", component: TheCreateMedicalCard },
],
},

View File

@@ -464,6 +464,7 @@ const actions = {
if (!data) {
return this.createMedicalCard(localStorage.getItem("medicalId"));
}
localStorage.setItem("medicalCardId", data.id);
commit("setMedicalCard", data);
commit("setBasicData");
commit("setContactsData");