diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 69d8a759..1f0d39b2 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -51,12 +51,8 @@ export const handle: Handle = async ({ event, resolve }) => { event.locals.isShowBackButton = isShowBackButton const storeId = event.cookies.get('storeId') - console.log('storeId', storeId) - // const store = event.cookies.get('store') || '{}' - // const storeAsJson = JSON.parse(store) if (storeId && storeId != 'undefined') { event.locals.storeId = storeId - // event.locals.store = storeAsJson } else { try { const { storeOne } = await InitService.fetchInit({ @@ -64,34 +60,7 @@ export const handle: Handle = async ({ event, resolve }) => { origin: event.locals.origin }) const storeId = storeOne?._id - // const store = { - // id: storeOne?.id, - // currencyCode: storeOne?.currencyCode, - // description: storeOne?.description, - // domain: storeOne?.domain, - // email: storeOne?.email, - // phone: storeOne?.phone, - // favicon: storeOne?.favicon, - // fontFamily: storeOne?.fontFamily, - // keywords: storeOne?.keywords, - // logo: storeOne?.logo, - // metaDescription: storeOne?.metaDescription, - // socialSharingButtons: storeOne?.socialSharingButtons, - // themeColor: storeOne?.themeColor, - // title: storeOne?.title, - // websiteName: storeOne?.websiteName, - // isMultiVendor: storeOne?.isMultiVendor, - // adminUrl: storeOne?.adminUrl, - // address: storeOne?.address, - // saasName: storeOne?.saasName, - // saasDomain: storeOne?.saasDomain, - // guaranteed_response_time: storeOne?.guaranteed_response_time, - // product_image_dimension: storeOne?.product_image_dimension, - // isSecureCatalogue: storeOne?.isSecureCatalogue, - // store_timings: storeOne?.store_timings, - // isHyperlocal: storeOne?.isHyperlocal, - // IMAGE_CDN_URL: storeOne?.IMAGE_CDN_URL - // } + if (!storeId || storeId == 'undefined') { throw { status: 404, message: `Could not find STORE for domain = ${url.host}` } } @@ -106,30 +75,13 @@ export const handle: Handle = async ({ event, resolve }) => { } // This calls init only when store data not present in browser cookies - // const { storeOne } = await fetchStoreData(event) - // console.timeEnd('init1') - - // event.locals.menu = menu || [] - // event.locals.megamenu = megamenu || [] - // this simply gets data from cookie event.locals.me = await authenticateUser(event) const zip = event.cookies.get('zip') event.locals.sid = event.cookies.get('connect.sid') event.locals.cartId = event.cookies.get('cartId') if (zip) event.locals.zip = JSON.parse(zip) - // This makes a call to backend on every request - - // await fetchCart(event) - - // const derivedSid: string = event.cookies.get('connect.sid') || '' - //Cart(event) - - // const derivedSid: string = event.cookies.get('connect.sid') || '' - // const route = event.url - // const start = performance.now() - // event.locals.sid = derivedSid - // event.request.headers.delete('connection') + const response = await resolve(event) // const end = performance.now() diff --git a/vite.config.ts b/vite.config.ts index 8c4ec7e3..6c99d5b8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -32,7 +32,7 @@ export default defineConfig(({ command, mode }) => { // }) ], server: { - allowedHosts: ['*'], + allowedHosts: 'all', host: true, port: 3000, proxy: {