создал homepage

This commit is contained in:
dderbentsov
2023-09-17 15:44:30 +03:00
parent 4bdd665d1f
commit c2eb6bf1e9
3 changed files with 33 additions and 2 deletions

View File

@@ -88,7 +88,7 @@ export default {
}, },
methods: { methods: {
redirectHomePage() { redirectHomePage() {
this.$router.push("/calendar"); this.$router.push("/");
}, },
async logout() { async logout() {
await fetchWrapper.post("auth/logout"); await fetchWrapper.post("auth/logout");

View File

@@ -0,0 +1,29 @@
<template lang="pug">
.wrapper.flex.flex-col.w-full.bg-white.p-4
.text-xxl.font-bold.pa-3
.text Добрый день, %username%!
.text.pt-3.cursor-pointer(@click="gotoCalendar") Расписание приемов
.text.pt-3.cursor-pointer(@click="gotoMedicalCards") Медицинские карты
</template>
<script>
export default {
name: "TheHome",
methods: {
gotoCalendar() {
this.$router.push("/calendar");
},
gotoMedicalCards() {
this.$router.push("/medcards");
},
},
};
</script>
<style lang="sass" scoped>
.wrapper
overflow: auto
border-top-left-radius: 4px
border-top-right-radius: 4px
</style>

View File

@@ -6,6 +6,7 @@ import TheLogin from "@/pages/login/TheLogin";
import LoggedInLayout from "@/components/LoggedInLayout"; import LoggedInLayout from "@/components/LoggedInLayout";
import TheMedicalCard from "@/pages/newMedicalCard/TheMedicalCard"; import TheMedicalCard from "@/pages/newMedicalCard/TheMedicalCard";
import { fetchWrapper } from "@/shared/fetchWrapper"; import { fetchWrapper } from "@/shared/fetchWrapper";
import TheHome from "@/pages/home/TheHome";
const ifNotAuthenticated = async (to, from, next) => { const ifNotAuthenticated = async (to, from, next) => {
const data = await fetchWrapper.get("users/me"); const data = await fetchWrapper.get("users/me");
@@ -34,7 +35,8 @@ export default createRouter({
beforeEnter: ifAuthenticated, beforeEnter: ifAuthenticated,
children: [ children: [
{ path: "", redirect: "calendar" }, { path: "", redirect: "home" },
{ path: "home", component: TheHome },
{ path: "calendar", component: TheCalendar }, { path: "calendar", component: TheCalendar },
{ path: "medcards", component: TheMedcards }, { path: "medcards", component: TheMedcards },
{ path: "settings", component: TheSettings }, { path: "settings", component: TheSettings },