added logout function and persistent pinia store

This commit is contained in:
Jona Kläß
2024-05-02 15:21:33 +02:00
parent cb68ec0d35
commit 64edf9b81c
10 changed files with 104 additions and 202 deletions

View File

@@ -1,47 +1,25 @@
<template>
<q-page class="row items-center justify-evenly">
<example-component
title="Example component"
active
:todos="todos"
:meta="meta"
></example-component>
<q-btn v-if="!userStore.keycloak" @click="login()" label="Login" />
<q-btn @click="$router.push('/test')" label="Test" />
</q-page>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Todo, Meta } from 'components/models';
import ExampleComponent from 'components/ExampleComponent.vue';
<script lang="ts">
import { defineComponent } from 'vue';
import { useUserStore } from 'stores/user-store';
defineOptions({
name: 'IndexPage'
});
const todos = ref<Todo[]>([
{
id: 1,
content: 'ct1'
export default defineComponent({
components: {
},
{
id: 2,
content: 'ct2'
},
{
id: 3,
content: 'ct3'
},
{
id: 4,
content: 'ct4'
},
{
id: 5,
content: 'ct5'
setup() {
const userStore = useUserStore();
const login = () => {
userStore.login();
};
return { login, userStore };
}
]);
const meta = ref<Meta>({
totalCount: 1200
});
</script>

View File

@@ -1,9 +1,11 @@
<script setup lang="ts">
import ProtectedData from 'components/ProtectedData.vue';
</script>
<template>
<h1>Hallloooooooooo</h1>
<ProtectedData />
</template>
<style scoped>