Fix initial loading state
This commit is contained in:
parent
44e247703d
commit
cee693b976
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="alpha-banner py-1 px-3 bg-amber text-black">
|
<div class="alpha-banner py-1 px-3 bg-amber text-black">
|
||||||
<v-icon size="small" icon="mdi-bug" />
|
<v-icon size="small" icon="mdi-bug" start />
|
||||||
Em desenvolvimento! Versão 0.0.0.½ Alpha Gambiarra
|
<small>Em desenvolvimento! Versão 0.0.0.½ Alpha Gambiarra</small>
|
||||||
</div>
|
</div>
|
||||||
<v-app>
|
<v-app>
|
||||||
<v-main>
|
<v-main>
|
||||||
|
@ -17,12 +17,12 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useAppStore } from './store/appStore'
|
import { useAppStore } from './store/appStore'
|
||||||
import { onMounted } from 'vue'
|
import { onBeforeMount } from 'vue'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
|
|
||||||
onMounted(async () => {
|
onBeforeMount(async () => {
|
||||||
await appStore.fetchMe()
|
await appStore.fetchMe()
|
||||||
|
|
||||||
if (!appStore.me) {
|
if (!appStore.me) {
|
||||||
|
@ -31,6 +31,8 @@ onMounted(async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
appStore.selectedCampus = appStore.me?.campus || ''
|
appStore.selectedCampus = appStore.me?.campus || ''
|
||||||
|
|
||||||
|
await appStore.fetchPrinters()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -40,7 +42,7 @@ onMounted(async () => {
|
||||||
bottom: 5px;
|
bottom: 5px;
|
||||||
right: 5px;
|
right: 5px;
|
||||||
z-index: 99999;
|
z-index: 99999;
|
||||||
opacity: 0.7;
|
opacity: 0.5;
|
||||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 2px 2px rgba(0, 0, 0, 0.12),
|
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 2px 2px rgba(0, 0, 0, 0.12),
|
||||||
0 4px 4px rgba(0, 0, 0, 0.12), 0 8px 8px rgba(0, 0, 0, 0.12),
|
0 4px 4px rgba(0, 0, 0, 0.12), 0 8px 8px rgba(0, 0, 0, 0.12),
|
||||||
0 16px 16px rgba(0, 0, 0, 0.12);
|
0 16px 16px rgba(0, 0, 0, 0.12);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
class="ml-2"
|
class="ml-2"
|
||||||
:items="campiSelectItems"
|
:items="campiSelectItems"
|
||||||
v-model="appStore.selectedCampus"
|
v-model="appStore.selectedCampus"
|
||||||
@update:model-value="appStore.fetchPrinters"
|
@update:menu="appStore.fetchPrinters"
|
||||||
hide-details
|
hide-details
|
||||||
center-affix
|
center-affix
|
||||||
variant="solo"
|
variant="solo"
|
||||||
|
|
|
@ -15,7 +15,10 @@ export const useAppStore = defineStore('app', {
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
async fetchPrinters(force = false) {
|
async fetchPrinters(force = false) {
|
||||||
|
if (this.loadingPrinters) return
|
||||||
|
|
||||||
this.loadingPrinters = true
|
this.loadingPrinters = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.printers = await api<any[]>(
|
this.printers = await api<any[]>(
|
||||||
`printer?${new URLSearchParams({
|
`printer?${new URLSearchParams({
|
||||||
|
|
|
@ -26,11 +26,5 @@
|
||||||
import PrinterCard from '@/components/PrinterCard.vue'
|
import PrinterCard from '@/components/PrinterCard.vue'
|
||||||
import { useAppStore } from '@/store/appStore'
|
import { useAppStore } from '@/store/appStore'
|
||||||
|
|
||||||
import { onMounted } from 'vue'
|
|
||||||
|
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
await appStore.fetchPrinters()
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user