@fy-/fws-vue 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -348,7 +348,7 @@ onUnmounted(() => {
348
348
  class="grid gap-4 items-start relative"
349
349
  v-if="i + (1 % gridHeight) == 0"
350
350
  >
351
- <div v-if="ranking" class="img-gallery-ranking">#{{ i }}</div>
351
+ <div v-if="ranking" class="img-gallery-ranking">{{ i }}</div>
352
352
 
353
353
  <template v-for="j in gridHeight" :key="`gi_${id}_${i + j}`">
354
354
  <div>
@@ -372,7 +372,7 @@ onUnmounted(() => {
372
372
  </div>
373
373
  </template>
374
374
  <div class="relative" v-else>
375
- <div v-if="ranking" class="img-gallery-ranking">#{{ i }}</div>
375
+ <div v-if="ranking" class="img-gallery-ranking">{{ i }}</div>
376
376
  <img
377
377
  @click="$eventBus.emit(`${id}GalleryImage`, i - 1)"
378
378
  class="h-auto max-w-full rounded-lg cursor-pointer"
package/index.ts CHANGED
@@ -11,7 +11,12 @@ import {
11
11
  isServerRendered,
12
12
  } from "./composables/ssr";
13
13
  import { useSeo } from "./composables/seo";
14
- import { useUserStore, useUserCheck, useUserCheckAsync } from "./stores/user";
14
+ import {
15
+ useUserStore,
16
+ useUserCheck,
17
+ useUserCheckAsync,
18
+ useUserCheckAsyncSimple,
19
+ } from "./stores/user";
15
20
  import { ClientOnly } from "./components/ssr/ClientOnly";
16
21
  import {
17
22
  cropText,
@@ -115,6 +120,7 @@ export {
115
120
  useUserCheck,
116
121
  useUserCheckAsync,
117
122
  useRest,
123
+ useUserCheckAsyncSimple,
118
124
 
119
125
  // Components
120
126
  // UI/Transitions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fy-/fws-vue",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "author": "Florian 'Fy' Gasquez <m@fy.to>",
5
5
  "license": "MIT",
6
6
  "repository": {
package/stores/user.ts CHANGED
@@ -48,6 +48,35 @@ export const useUserStore = defineStore({
48
48
  },
49
49
  });
50
50
 
51
+ export async function useUserCheckAsyncSimple(
52
+ path = "/login",
53
+ redirectLink = false,
54
+ ) {
55
+ const userStore = useUserStore();
56
+ await userStore.refreshUser();
57
+ const isAuth = computed(() => userStore.isAuth);
58
+ const router = useServerRouter();
59
+
60
+ const checkUser = (route: RouteLocation) => {
61
+ if (route.meta.reqLogin) {
62
+ if (!isAuth.value) {
63
+ if (!redirectLink) router.push(path);
64
+ else {
65
+ router.status = 307;
66
+ router.push(`${path}?return_to=${route.path}`);
67
+ }
68
+ }
69
+ }
70
+ };
71
+ checkUser(router.currentRoute);
72
+
73
+ router._router.beforeEach((to: any) => {
74
+ if (to.fullPath != path) {
75
+ checkUser(to);
76
+ }
77
+ });
78
+ }
79
+
51
80
  export async function useUserCheckAsync(path = "/login", redirectLink = false) {
52
81
  const userStore = useUserStore();
53
82
  await userStore.refreshUser();