From 37d2e0e2020fbb4407f4904d0e93d05cc17bd382 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Sat, 17 May 2025 09:46:43 +0700 Subject: [PATCH] feat: fixed adding channels --- libraries/helpers/src/utils/custom.fetch.func.ts | 4 +--- libraries/helpers/src/utils/internal.fetch.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libraries/helpers/src/utils/custom.fetch.func.ts b/libraries/helpers/src/utils/custom.fetch.func.ts index b4c175b2..c7a563a4 100644 --- a/libraries/helpers/src/utils/custom.fetch.func.ts +++ b/libraries/helpers/src/utils/custom.fetch.func.ts @@ -1,5 +1,3 @@ -'use client'; - export interface Params { baseUrl: string; beforeRequest?: (url: string, options: RequestInit) => Promise; @@ -16,7 +14,7 @@ export const customFetch = ( secured: boolean = true ) => { return async function newFetch(url: string, options: RequestInit = {}) { - const loggedAuth = new URL(window.location.href).searchParams.get( + const loggedAuth = typeof window === "undefined" ? undefined : new URL(window.location.href).searchParams.get( 'loggedAuth' ); const newRequestObject = await params?.beforeRequest?.(url, options); diff --git a/libraries/helpers/src/utils/internal.fetch.ts b/libraries/helpers/src/utils/internal.fetch.ts index 86e6cd38..84006be3 100644 --- a/libraries/helpers/src/utils/internal.fetch.ts +++ b/libraries/helpers/src/utils/internal.fetch.ts @@ -1,5 +1,5 @@ -import { customFetch } from './custom.fetch.func'; import { cookies } from 'next/headers'; +import { customFetch } from '@gitroom/helpers/utils/custom.fetch.func'; export const internalFetch = (url: string, options: RequestInit = {}) => customFetch(