Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/assets/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
flex-direction: column;
flex: 1 1 auto;
width: 100%;
margin-inline: auto;
}

@utility no-scrollbar {
Expand Down
1 change: 0 additions & 1 deletion app/components/shopify/cart/cart-drawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import type { CartLineFragment } from '@@/types/shopify-storefront'

import { useMagicKeys } from '@vueuse/core'
import { flattenConnection } from '@/utils/graphql'

// Stores
const appStore = useAppStore()
Expand Down
1 change: 0 additions & 1 deletion app/components/shopify/product-card/product-card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import type { ProductFragment } from '@@/types/shopify-storefront'

import { getColorOption } from '@/helpers/shopify'
import { flattenConnection } from '@/utils/graphql'

// Props
const props = defineProps<{
Expand Down
6 changes: 4 additions & 2 deletions app/pages/account/addresses/add.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ const handleCreateAddress = async () => {
if (response?.customerAddress) {
await navigateTo('/account/addresses')
}
} catch (error: any) {
errorMessage.value = `${error.message}. Please verify your address details and try again.`
} catch (error) {
if (error instanceof Error) {
errorMessage.value = `${error.message}. Please verify your address details and try again.`
}
} finally {
isLoading.value = false
}
Expand Down
6 changes: 4 additions & 2 deletions app/pages/account/addresses/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ const handleUpdateAddress = async () => {
if (response?.customerAddress) {
await navigateTo('/account/addresses')
}
} catch (error: any) {
errorMessage.value = `${error.message}. Please verify your address details and try again.`
} catch (error) {
if (error instanceof Error) {
errorMessage.value = `${error.message}. Please verify your address details and try again.`
}
} finally {
isLoading.value = false
}
Expand Down
2 changes: 0 additions & 2 deletions app/pages/account/addresses/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import type {
MailingAddressFragment,
} from '@@/types/shopify-storefront'

import { flattenConnection } from '@/utils/graphql'

// Stores
const authStore = useAuthStore()
const shopStore = useShopStore()
Expand Down
2 changes: 0 additions & 2 deletions app/pages/account/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import type {
MailingAddressFragment,
} from '@@/types/shopify-storefront'

import { flattenConnection } from '@/utils/graphql'

// Stores
const authStore = useAuthStore()
const shopStore = useShopStore()
Expand Down
8 changes: 5 additions & 3 deletions app/pages/account/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ const handleLogin = async () => {
await cartStore.attachBuyer({ customerAccessToken: authStore.accessToken })
await navigateTo('/account')
}
} catch (error: any) {
errorMessage.value = `${error.message}. Please try again later.`
} catch (error) {
if (error instanceof Error) {
errorMessage.value = `${error.message}. Please try again later.`
}
} finally {
isLoading.value = false
}
Expand All @@ -64,7 +66,7 @@ useHead({
</script>

<template>
<section class="wrapper px-6 pt-28 mx-auto md:pt-32 md:max-w-[400px] md:px-0">
<section class="wrapper px-6 pt-28 md:pt-32 md:max-w-[400px] md:px-0">
<h1 class="text-xl tracking-tight leading-none text-center">
Login
</h1>
Expand Down
4 changes: 1 addition & 3 deletions app/pages/account/orders/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import type {
OrderFragment,
} from '@@/types/shopify-storefront'

import { flattenConnection } from '@/utils/graphql'

// Stores
const authStore = useAuthStore()
const shopStore = useShopStore()
Expand Down Expand Up @@ -44,7 +42,7 @@ definePageMeta({
</script>

<template>
<section class="relative flex flex-col lg:col-span-2 2xl:col-span-1 mb-20">
<section class="flex flex-col lg:col-span-2 2xl:col-span-1 mb-20">
<div class="flex flex-col gap-6 lg:mt-6 lg:px-8">
<h2 class="px-6 text-xl tracking-tight leading-none lg:p-0">
Orders ({{ orders?.length }})
Expand Down
8 changes: 5 additions & 3 deletions app/pages/account/recover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ const handleRecover = async () => {
try {
await authStore.recover(email.value)
successMessage.value = 'Success! Please check your email for instructions on how to reset your password.'
} catch (error: any) {
errorMessage.value = `${error.message}. Please try again later.`
} catch (error) {
if (error instanceof Error) {
errorMessage.value = `${error.message}. Please try again later.`
}
} finally {
isLoading.value = false
}
Expand All @@ -47,7 +49,7 @@ useHead({
</script>

<template>
<section class="wrapper px-6 pt-28 mx-auto md:pt-32 md:max-w-[400px] md:px-0">
<section class="wrapper px-6 pt-28 md:pt-32 md:max-w-[400px] md:px-0">
<h1 class="text-xl tracking-tight leading-none text-center">
Forgot password?
</h1>
Expand Down
8 changes: 5 additions & 3 deletions app/pages/account/register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ const handleRegister = async () => {
if (isAuth.value) {
await navigateTo('/account')
}
} catch (error: any) {
errorMessage.value = `${error.message}. Please try again later.`
} catch (error) {
if (error instanceof Error) {
errorMessage.value = `${error.message}. Please try again later.`
}
} finally {
isLoading.value = false
}
Expand All @@ -89,7 +91,7 @@ useHead({
</script>

<template>
<section class="wrapper px-6 pt-28 mx-auto md:pt-32 md:max-w-[400px] md:px-0">
<section class="wrapper px-6 pt-28 md:pt-32 md:max-w-[400px] md:px-0">
<h1 class="text-xl tracking-tight leading-none text-center">
Register
</h1>
Expand Down
8 changes: 5 additions & 3 deletions app/pages/account/reset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ const handleReset = async () => {
if (isAuth.value) {
await navigateTo('/account')
}
} catch (error: any) {
errorMessage.value = `${error.message}. Please try again later.`
} catch (error) {
if (error instanceof Error) {
errorMessage.value = `${error.message}. Please try again later.`
}
} finally {
isLoading.value = false
}
Expand All @@ -78,7 +80,7 @@ useHead({
</script>

<template>
<section class="wrapper px-6 pt-28 mx-auto md:pt-32 md:max-w-[400px] md:px-0">
<section class="wrapper px-6 pt-28 md:pt-32 md:max-w-[400px] md:px-0">
<h1 class="text-xl tracking-tight leading-none text-center">
Enter a new password
</h1>
Expand Down
1 change: 0 additions & 1 deletion app/pages/collections/[handle].vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
} from '@@/types/shopify-storefront'

import { getCollectionSortValues, getFilterValues } from '@/helpers/shopify'
import { flattenConnection } from '@/utils/graphql'

// Route data
const route = useRoute()
Expand Down
2 changes: 0 additions & 2 deletions app/pages/products/[handle].vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import type {
ProductVariantFragment,
} from '@@/types/shopify-storefront'

import { flattenConnection } from '@/utils/graphql'

// Route data
const route = useRoute()
const handle = computed(() => route.params.handle as string)
Expand Down
1 change: 0 additions & 1 deletion app/pages/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
} from '@@/types/shopify-storefront'

import { getSearchSortValues, getFilterValues } from '@/helpers/shopify'
import { flattenConnection } from '@/utils/graphql'

// Route data
const route = useRoute()
Expand Down
24 changes: 12 additions & 12 deletions app/stores/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export const useAuthStore = defineStore('@nikkoel/auth', {
this.accessToken = response.customerAccessToken.accessToken
await this.getCustomer()
}
} catch (error: any) {
console.error('Cannot create customer access token:', error.message)
} catch (error) {
console.error('Cannot create customer access token:', error)
throw error
}
},
Expand All @@ -70,8 +70,8 @@ export const useAuthStore = defineStore('@nikkoel/auth', {
}

this.customer = customerInfo
} catch (error: any) {
console.error('Cannot get customer data:', error.message)
} catch (error) {
console.error('Cannot get customer data:', error)
throw error
}
},
Expand All @@ -93,8 +93,8 @@ export const useAuthStore = defineStore('@nikkoel/auth', {
email: input.email,
password: input.password,
})
} catch (error: any) {
console.error('Cannot create new customer:', error.message)
} catch (error) {
console.error('Cannot create new customer:', error)
throw error
}
},
Expand Down Expand Up @@ -126,8 +126,8 @@ export const useAuthStore = defineStore('@nikkoel/auth', {
this.accessToken = ''
this.customer = null
}
} catch (error: any) {
console.error('Cannot delete access token:', error.message)
} catch (error) {
console.error('Cannot delete access token:', error)
throw error
}
},
Expand All @@ -146,8 +146,8 @@ export const useAuthStore = defineStore('@nikkoel/auth', {
}

return response
} catch (error: any) {
console.error('Cannot recover customer password:', error.message)
} catch (error) {
console.error('Cannot recover customer password:', error)
throw error
}
},
Expand Down Expand Up @@ -175,8 +175,8 @@ export const useAuthStore = defineStore('@nikkoel/auth', {
this.accessToken = response.customerAccessToken.accessToken
await this.getCustomer()
}
} catch (error: any) {
console.error('Cannot reset customer password:', error.message)
} catch (error) {
console.error('Cannot reset customer password:', error)
throw error
}
},
Expand Down
24 changes: 12 additions & 12 deletions app/stores/cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export const useCartStore = defineStore('@nikkoel/cart', {
}

this.cart = response?.cart
} catch (error: any) {
console.error('Cannot create cart:', error.message)
} catch (error) {
console.error('Cannot create cart:', error)
throw error
}
},
Expand Down Expand Up @@ -78,8 +78,8 @@ export const useCartStore = defineStore('@nikkoel/cart', {
}

this.cart = response
} catch (error: any) {
console.error('Connot get cart data:', error.message)
} catch (error) {
console.error('Connot get cart data:', error)
throw error
}
},
Expand All @@ -106,8 +106,8 @@ export const useCartStore = defineStore('@nikkoel/cart', {
}

this.cart = response?.cart
} catch (error: any) {
console.error('Cannot add lines:', error.message)
} catch (error) {
console.error('Cannot add lines:', error)
throw error
}
},
Expand All @@ -134,8 +134,8 @@ export const useCartStore = defineStore('@nikkoel/cart', {
}

this.cart = response?.cart
} catch (error: any) {
console.error('Cannot remove lines:', error.message)
} catch (error) {
console.error('Cannot remove lines:', error)
throw error
}
},
Expand All @@ -162,8 +162,8 @@ export const useCartStore = defineStore('@nikkoel/cart', {
}

this.cart = response?.cart
} catch (error: any) {
console.error('Cannot update cart lines:', error.message)
} catch (error) {
console.error('Cannot update cart lines:', error)
throw error
}
},
Expand All @@ -190,8 +190,8 @@ export const useCartStore = defineStore('@nikkoel/cart', {
}

this.cart = response?.cart
} catch (error: any) {
console.error('Cannot update cart buyer identity:', error.message)
} catch (error) {
console.error('Cannot update cart buyer identity:', error)
throw error
}
},
Expand Down
4 changes: 2 additions & 2 deletions app/stores/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export const useShopStore = defineStore('@nikkoel/shop', {
this.locale.availableLanguages = response.availableLanguages
this.locale.country = response.country
this.locale.language = response.language
} catch (error: any) {
console.error('Connot get localization data:', error.message)
} catch (error) {
console.error('Connot get localization data:', error)
throw error
}
},
Expand Down
21 changes: 13 additions & 8 deletions modules/shopify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,20 @@ export default defineNuxtModule<ModuleOptions>({

const { resolve } = createResolver(import.meta.url)

addImports({
name: 'useShopify',
from: resolve('runtime/composables/use-shopify'),
})
const imports = [
{
name: 'useShopify',
from: resolve('runtime/composables/use-shopify'),
},
{
name: 'flattenConnection',
from: resolve('runtime/utils/flatten-connection'),
},
]

addImports(imports)

addServerImports([{
name: 'useShopify',
from: resolve('runtime/composables/use-shopify'),
}])
addServerImports(imports)

addServerHandler({
method: 'post',
Expand Down
File renamed without changes.
Loading