Skip to content

Commit

Permalink
remove console.log from hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
itswadesh committed Jan 20, 2025
1 parent 570add3 commit 7182143
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 51 deletions.
52 changes: 2 additions & 50 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,47 +51,16 @@ 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({
host: DOMAIN || host,
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}` }
}
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default defineConfig(({ command, mode }) => {
// })
],
server: {
allowedHosts: ['*'],
allowedHosts: 'all',
host: true,
port: 3000,
proxy: {
Expand Down

0 comments on commit 7182143

Please sign in to comment.