Skip to content

Commit

Permalink
fix(pages): workaround locale-path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed Oct 5, 2022
1 parent 7c3b402 commit 259873e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions nuxt/pages/account/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import { useMaevsiStore } from '~/store'
definePageMeta({
middleware: [
function (_to: any, _from: any) {
const localePath = useLocalePath()
const { $localePath } = useNuxtApp()
const store = useMaevsiStore()
if (store.jwtDecoded?.role === 'maevsi_account') {
return navigateTo(localePath('/account/' + store.jwtDecoded.username))
return navigateTo($localePath('/account/' + store.jwtDecoded.username))
} else {
return navigateTo(localePath('/task/account/sign-in'))
return navigateTo($localePath('/task/account/sign-in'))
}
},
],
Expand Down
4 changes: 2 additions & 2 deletions nuxt/pages/dashboard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ import { useMaevsiStore } from '~/store'
definePageMeta({
middleware: [
function (_to: any, _from: any) {
const localePath = useLocalePath()
const { $localePath } = useNuxtApp()
const store = useMaevsiStore()
if (store.jwtDecoded?.role === 'maevsi_anonymous') {
return navigateTo(localePath('/'))
return navigateTo($localePath('/'))
}
},
],
Expand Down
4 changes: 2 additions & 2 deletions nuxt/pages/task/account/email-address/verify.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import { useAccountEmailAddressVerificationMutation } from '~/gql/generated'
definePageMeta({
middleware: [
function (_to: any, _from: any) {
const localePath = useLocalePath()
const { $localePath } = useNuxtApp()
const route = useRoute()
if (
Array.isArray(route.query.code) ||
route.query.code === null ||
!REGEX_UUID.test(route.query.code)
) {
return navigateTo(localePath('/'))
return navigateTo($localePath('/'))
}
},
],
Expand Down
4 changes: 2 additions & 2 deletions nuxt/pages/task/account/password/reset/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import { REGEX_UUID } from '~/plugins/util/validation'
definePageMeta({
middleware: [
function (_to: any, _from: any) {
const localePath = useLocalePath()
const { $localePath } = useNuxtApp()
const route = useRoute()
if (
Array.isArray(route.query.code) ||
route.query.code === null ||
!REGEX_UUID.test(route.query.code)
) {
return navigateTo(localePath('/'))
return navigateTo($localePath('/'))
}
},
],
Expand Down
4 changes: 2 additions & 2 deletions nuxt/pages/task/account/sign-in.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ import { useMaevsiStore } from '~/store'
definePageMeta({
middleware: [
function (_to: any, _from: any) {
const localePath = useLocalePath()
const { $localePath } = useNuxtApp()
const route = useRoute()
const store = useMaevsiStore()
if (
store.jwtDecoded?.role === 'maevsi_account' &&
!Array.isArray(route.query.referrer)
) {
return navigateTo(route.query.referrer || localePath('/dashboard/'))
return navigateTo(route.query.referrer || $localePath('/dashboard/'))
}
},
],
Expand Down
4 changes: 2 additions & 2 deletions nuxt/pages/task/event/create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import { useMaevsiStore } from '~/store'
definePageMeta({
middleware: [
function (_to: any, _from: any) {
const localePath = useLocalePath()
const { $localePath } = useNuxtApp()
const route = useRoute()
const store = useMaevsiStore()
if (store.jwtDecoded?.role !== 'maevsi_account') {
return navigateTo(
localePath({
$localePath({
path: '/task/account/sign-in',
query: { referrer: route.fullPath },
})
Expand Down
10 changes: 5 additions & 5 deletions nuxt/pages/task/event/unlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ definePageMeta({
middleware: [
async function (_to: any, _from: any) {
const { $urqlReset, ssrContext } = useNuxtApp()
const localePath = useLocalePath()
const { $localePath } = useNuxtApp()
const route = useRoute()
const store = useMaevsiStore()
Expand All @@ -95,7 +95,7 @@ definePageMeta({
if (!result.data?.eventUnlock?.eventUnlockResponse) {
return navigateTo(
localePath({
$localePath({
query: {
...route.query,
error: null,
Expand All @@ -113,16 +113,16 @@ definePageMeta({
if ('quick' in route.query) {
return navigateTo(
localePath(
$localePath(
`/event/${result.data.eventUnlock.eventUnlockResponse.authorUsername}/${result.data.eventUnlock.eventUnlockResponse.eventSlug}`
)
)
} else {
return navigateTo(
localePath({
$localePath({
query: {
...route.query,
redirect: localePath(
redirect: $localePath(
`/event/${result.data.eventUnlock.eventUnlockResponse.authorUsername}/${result.data.eventUnlock.eventUnlockResponse.eventSlug}`
),
},
Expand Down

0 comments on commit 259873e

Please sign in to comment.