Skip to content

A self-hosted media server and file management system

chore: fix up refresh messages that don't convey real info

aminnausin618779a8b744
diff --git a/resources/js/components/dashboard/DashboardTasks.vue b/resources/js/components/dashboard/DashboardTasks.vue
index 6191cf48..71239f5d 100644
--- a/resources/js/components/dashboard/DashboardTasks.vue
+++ b/resources/js/components/dashboard/DashboardTasks.vue
@@ -226,15 +226,7 @@ onUnmounted(async () => {
<DashboardTaskMenu @handle-close="taskPopover?.handleClose" />
</template>
</BasePopover>
- <ButtonText
- @click="
- () => {
- loadData().then(() => {
- toast.add('Success', { type: 'success', description: 'Data Refreshed!', life: 3000 });
- });
- }
- "
- >
+ <ButtonText @click="loadData">
<template #text>Refresh</template>
<template #icon><ProiconsArrowSync /></template>
</ButtonText>
diff --git a/resources/js/components/dashboard/DashboardUsers.vue b/resources/js/components/dashboard/DashboardUsers.vue
index 839dda9b..4eb60cef 100644
--- a/resources/js/components/dashboard/DashboardUsers.vue
+++ b/resources/js/components/dashboard/DashboardUsers.vue
@@ -135,15 +135,7 @@ onMounted(() => {
<template #text>New User</template>
<template #icon><ProiconsAdd /></template>
</ButtonText>
- <ButtonText
- @click="
- () => {
- loadData().then(() => {
- toast.add('Success', { type: 'success', description: 'Data Refreshed!', life: 3000 });
- });
- }
- "
- >
+ <ButtonText @click="loadData">
<template #text>Refresh</template>
<template #icon><ProiconsArrowSync /></template>
</ButtonText>
diff --git a/resources/js/components/table/TableBase.vue b/resources/js/components/table/TableBase.vue
index 669cabb7..a07ee0c4 100755
--- a/resources/js/components/table/TableBase.vue
+++ b/resources/js/components/table/TableBase.vue
@@ -13,8 +13,6 @@ import SvgSpinners90RingWithBg from '~icons/svg-spinners/90-ring-with-bg';
import PhSortDescendingLight from '~icons/ph/sort-descending-light';
import PhSortAscendingLight from '~icons/ph/sort-ascending-light';
-// 👇 Generic prop types
-
const props = withDefaults(defineProps<TableProps<T>>(), {
useToolbar: true,
usePagination: true,
diff --git a/resources/js/layouts/AuthGate.vue b/resources/js/layouts/AuthGate.vue
new file mode 100644
index 00000000..81360610
--- /dev/null
+++ b/resources/js/layouts/AuthGate.vue
@@ -0,0 +1,19 @@
+<script setup lang="ts">
+import { useAuthStore } from '@/stores/AuthStore';
+import { storeToRefs } from 'pinia';
+import { useRoute } from 'vue-router';
+
+import SvgSpinners90RingWithBg from '~icons/svg-spinners/90-ring-with-bg';
+
+const route = useRoute();
+
+const { userData, isLoadingUserData } = storeToRefs(useAuthStore());
+</script>
+
+<template>
+ <slot v-if="!route.meta?.protected || (!isLoadingUserData && userData)"></slot>
+ <div v-else class="col-span-full flex items-center justify-center text-center text-lg text-gray-500 dark:text-gray-400 uppercase tracking-wider w-full gap-2">
+ <p>{{ '...Loading' }}</p>
+ <SvgSpinners90RingWithBg />
+ </div>
+</template>
diff --git a/resources/js/router/index.ts b/resources/js/router/index.ts
index 328c70ac..77439321 100644
--- a/resources/js/router/index.ts
+++ b/resources/js/router/index.ts
@@ -168,9 +168,9 @@ const router = createRouter({
});
const redirectAfterLogin = async (to: RouteLocationNormalizedGeneric, next: NavigationGuardNext, meta: RouteMeta) => {
- const { fetchUser } = useAuthStore();
+ const authStore = useAuthStore();
- if (await fetchUser()) {
+ if (await authStore.fetchUser()) {
// Logged in -> user and page is protected
next();
return;