Skip to content

Commit 9c21f71

Browse files
committed
fix: provide feedback that initial user data is loading
instead of prompting the user to log in
1 parent fdea9f3 commit 9c21f71

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

src/jelu-ui/src/App.vue

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import { useStore } from 'vuex'
3-
import { computed, onMounted, ref, watch } from 'vue'
3+
import { computed, onMounted, Ref, ref, watch } from 'vue'
44
import { key } from './store'
55
import { useRoute, useRouter } from 'vue-router'
66
import dataService from "./services/DataService";
@@ -21,7 +21,10 @@ console.log("route " + route.fullPath + " " + route.path + " " + route.redirecte
2121
console.log(route)
2222
console.log(router.currentRoute.value)
2323
24+
const initialLoad : Ref<boolean> = ref(false)
25+
2426
store.dispatch('setupStatus')
27+
initialLoad.value = true
2528
store.dispatch('getUser')
2629
.then(async () => {
2730
console.log("then")
@@ -31,13 +34,15 @@ store.dispatch('getUser')
3134
await router.push(store.state.route)
3235
}
3336
console.log("ok nav")
37+
initialLoad.value = false
3438
store.dispatch('getServerSettings')
3539
// } catch(e) {
3640
// console.log("error nav")
3741
// console.log(e)
3842
// }
3943
})
4044
.catch(() => {
45+
initialLoad.value = false
4146
console.log("catch in App")
4247
router.push({ name: 'login' }).then(() => { console.log("ok nav") }).catch(() => { console.log("error nav") })
4348
})
@@ -406,6 +411,16 @@ watch(() => route.name, (newVal, oldVal) => {
406411
</div>
407412
</label>
408413
</label>
414+
<o-loading
415+
v-model:active="initialLoad"
416+
:full-page="true"
417+
:can-cancel="false"
418+
>
419+
<!-- loader from https://loading.io/css/ -->
420+
<div class="lds-facebook">
421+
<div /><div /><div />
422+
</div>
423+
</o-loading>
409424
</section>
410425
</template>
411426

src/jelu-ui/src/assets/style.css

+41-1
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,44 @@
245245
/* title search input on search page, make it fill column */
246246
.title-input .o-ctrl-input {
247247
@apply w-full;
248-
}
248+
}
249+
250+
/* loader from https://loading.io/css/ */
251+
.lds-facebook {
252+
display: inline-block;
253+
position: relative;
254+
width: 80px;
255+
height: 80px;
256+
}
257+
.lds-facebook div {
258+
display: inline-block;
259+
position: absolute;
260+
left: 8px;
261+
width: 16px;
262+
background: theme('colors.accent');
263+
animation: lds-facebook 1.2s cubic-bezier(0, 0.5, 0.5, 1) infinite;
264+
}
265+
.lds-facebook div:nth-child(1) {
266+
left: 8px;
267+
animation-delay: -0.24s;
268+
}
269+
.lds-facebook div:nth-child(2) {
270+
left: 32px;
271+
animation-delay: -0.12s;
272+
}
273+
.lds-facebook div:nth-child(3) {
274+
left: 56px;
275+
animation-delay: 0;
276+
}
277+
@keyframes lds-facebook {
278+
0% {
279+
top: 8px;
280+
height: 64px;
281+
}
282+
50%, 100% {
283+
top: 24px;
284+
height: 32px;
285+
}
286+
}
287+
/* end loader from https://loading.io/css/ */
288+

0 commit comments

Comments
 (0)