@dargmuesli/nuxt-vio 3.0.0-beta.4 → 3.0.0-beta.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,7 +43,7 @@
43
43
  <script setup lang="ts">
44
44
  import type { BaseValidation } from '@vuelidate/core'
45
45
 
46
- import type { BackendError } from '~/../types/api'
46
+ import type { BackendError } from '../../../types/api'
47
47
 
48
48
  export interface Props {
49
49
  errors?: BackendError[]
@@ -53,7 +53,7 @@
53
53
  <VioFormInputIconWrapper v-if="validationProperty.$pending">
54
54
  <IconHourglass
55
55
  class="text-blue-600"
56
- :title="t('globalLoading')"
56
+ :title="t('globalStatusLoading')"
57
57
  />
58
58
  </VioFormInputIconWrapper>
59
59
  <VioFormInputIconWrapper
@@ -91,7 +91,7 @@
91
91
  <div class="md:w-2/3">
92
92
  <slot name="stateInfo" />
93
93
  <VioFormInputStateInfo v-if="value?.$pending">
94
- {{ t('globalLoading') }}
94
+ {{ t('globalStatusLoading') }}
95
95
  </VioFormInputStateInfo>
96
96
  </div>
97
97
  <div class="md:w-1/3" />
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  class="flex h-full items-center justify-center"
4
- :title="t('globalLoading')"
4
+ :title="t('globalStatusLoading')"
5
5
  >
6
6
  <div class="flex items-center justify-center w-1/2">
7
7
  <slot />
@@ -2,7 +2,7 @@
2
2
  <VioLoaderIndicator>
3
3
  <div
4
4
  class="w-1/2 aspect-square animate-ping rounded-full bg-gray-500"
5
- :title="t('globalLoading')"
5
+ :title="t('globalStatusLoading')"
6
6
  />
7
7
  </VioLoaderIndicator>
8
8
  </template>
@@ -18,6 +18,6 @@ export const useAppLayout = () => {
18
18
  ? `${titleChunk} ${siteConfig.titleSeparator} ${siteConfig.name}`
19
19
  : siteConfig.name
20
20
  },
21
- ...appConfig.vio.seoMeta,
21
+ ...(appConfig.vio.seoMeta ? appConfig.vio.seoMeta : {}),
22
22
  })
23
23
  }
package/locales/de.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "globalLoading": "Lade...",
2
+ "globalStatusLoading": "Lade...",
3
3
  "globalPlaceholderUrl": "https://websei.te",
4
4
  "globalStatusError": "Fehler",
5
5
  "globalValidationFailed": "Bitte überprüfe deine Eingaben 🙈",
package/locales/en.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "globalLoading": "Loading...",
2
+ "globalStatusLoading": "Loading...",
3
3
  "globalPlaceholderUrl": "https://websi.te",
4
4
  "globalStatusError": "Error",
5
5
  "globalValidationFailed": "Please check your input 🙈",
package/nuxt.config.ts CHANGED
@@ -164,7 +164,7 @@ export default defineNuxtConfig({
164
164
  url: BASE_URL,
165
165
  },
166
166
  sitemap: {
167
- exclude: ['/api/**'],
167
+ exclude: ['/api/pages/**'],
168
168
  },
169
169
  tailwindcss: {
170
170
  cssPath: join(currentDir, './assets/css/tailwind.css'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-vio",
3
- "version": "3.0.0-beta.4",
3
+ "version": "3.0.0-beta.6",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/plugins/dayjs.ts CHANGED
@@ -1,4 +1,5 @@
1
- import dayjs, { extend, locale } from 'dayjs'
1
+ /* eslint-disable import/no-named-as-default-member */
2
+ import dayjs from 'dayjs'
2
3
 
3
4
  // workaround for [1]
4
5
  import de from 'dayjs/locale/de'
@@ -10,13 +11,13 @@ import timezone from 'dayjs/plugin/timezone'
10
11
  import utc from 'dayjs/plugin/utc'
11
12
 
12
13
  export default defineNuxtPlugin((_nuxtApp) => {
13
- extend(isSameOrBefore)
14
- extend(localizedFormat)
15
- extend(timezone)
16
- extend(utc)
14
+ dayjs.extend(isSameOrBefore)
15
+ dayjs.extend(localizedFormat)
16
+ dayjs.extend(timezone)
17
+ dayjs.extend(utc)
17
18
 
18
19
  // workaround for [1]
19
- locale(de)
20
+ dayjs.locale(de)
20
21
  // dayjs.locale(en) makes `format` error
21
22
 
22
23
  return {
package/types/api.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- export type BackendError = CombinedError | { errcode: string; message: string }
1
+ import type { CombinedError } from '@urql/core'
2
2
 
3
3
  export type ApiData = ComputedRef<{
4
4
  data?: Object
5
5
  errors: BackendError[]
6
6
  isFetching: boolean
7
7
  }>
8
+
9
+ export type BackendError = CombinedError | { errcode: string; message: string }
@@ -106,10 +106,22 @@ export const getServiceHref = ({
106
106
  }
107
107
  }
108
108
 
109
- export const getTimezone = async (event: H3Event) =>
110
- getCookie(event, TIMEZONE_COOKIE_NAME) ||
111
- (
112
- await ofetch(
109
+ export const getTimezone = async (event: H3Event) => {
110
+ const timezoneCookie = getCookie(event, TIMEZONE_COOKIE_NAME)
111
+
112
+ if (timezoneCookie) {
113
+ return timezoneCookie
114
+ }
115
+
116
+ if (event.node.req.headers['x-real-ip']) {
117
+ const ipApiResult = await ofetch(
113
118
  `http://ip-api.com/json/${event.node.req.headers['x-real-ip']}`,
114
- )
115
- ).timezone
119
+ ).catch(() => {})
120
+
121
+ if (ipApiResult) {
122
+ return ipApiResult.timezone
123
+ }
124
+ }
125
+
126
+ return undefined
127
+ }