This repository has been archived on 2022-05-05. You can view files and clone it, but cannot push or open issues or pull requests.
userausfall/src/views/MainPage.vue

36 lines
1 KiB
Vue
Raw Normal View History

2021-04-13 09:06:28 +02:00
<template>
2021-04-13 11:01:50 +02:00
<section class="container">
<div class="columns is-centered">
2021-04-16 10:36:52 +02:00
<div
v-if="user.isAuthenticated"
2021-04-16 11:31:11 +02:00
class="column is-5-fullhd is-6-widescreen is-7-desktop is-7-tablet"
2021-04-16 10:36:52 +02:00
>
<UserTable :user="user" />
</div>
<div v-else class="column is-3-widescreen is-4-desktop is-5-tablet">
<LoginForm :user="user" />
2021-04-13 11:01:50 +02:00
</div>
</div>
</section>
2021-04-13 09:06:28 +02:00
</template>
<script lang="ts">
2021-05-18 11:06:02 +02:00
import { Component } from "vue-property-decorator";
2021-04-13 11:01:50 +02:00
import LoginForm from "@/components/LoginForm.vue";
2021-05-18 11:06:02 +02:00
import { mixins } from "vue-class-component";
2021-04-15 09:31:03 +02:00
import { User } from "@/api";
2021-04-15 11:36:21 +02:00
import UserTable from "@/components/UserTable.vue";
2021-05-18 11:06:02 +02:00
import { NotifyMixin } from "@/mixins";
2021-04-13 09:06:28 +02:00
2021-04-15 11:36:21 +02:00
@Component({ components: { UserTable, LoginForm } })
2021-05-18 11:06:02 +02:00
export default class Home extends mixins(NotifyMixin) {
2021-04-15 16:04:22 +02:00
private user = new User();
2021-04-15 09:31:03 +02:00
2021-04-16 10:36:52 +02:00
public async created(): Promise<void> {
if (!this.user.isAuthenticated && this.$route.name !== "login") {
2021-05-18 11:06:02 +02:00
this.$router.push({ name: "login" });
}
}
2021-04-15 09:31:03 +02:00
}
2021-04-13 09:06:28 +02:00
</script>