adds initial user defined panels
This commit is contained in:
30
frontend/src/views/PanelView.vue
Normal file
30
frontend/src/views/PanelView.vue
Normal file
@@ -0,0 +1,30 @@
|
||||
<script setup lang="ts">
|
||||
import DynamicComponent from '@/components/DynamicComponent.vue';
|
||||
import type { OptionalDynamicComponentData } from '@/composables/dynamic.ts';
|
||||
import { computed, ref, watchEffect } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const id = computed<string>(() => route.params.id as string);
|
||||
|
||||
const panel = ref<OptionalDynamicComponentData>({
|
||||
type: 'none',
|
||||
});
|
||||
|
||||
watchEffect(async () => {
|
||||
const panel_data = await fetch(`/api/panel/${id.value}`);
|
||||
const panel_json_value = await panel_data.json();
|
||||
panel.value = JSON.parse(
|
||||
panel_json_value['data'],
|
||||
) as OptionalDynamicComponentData;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DynamicComponent v-model:data="panel" :editable="false"></DynamicComponent>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use '@/assets/variables';
|
||||
</style>
|
||||
Reference in New Issue
Block a user