From cb2913b919e7a7f852ff126ec2e499d876b3acbe Mon Sep 17 00:00:00 2001
From: Leonardo Christino <leomilho@gmail.com>
Date: Wed, 25 Oct 2023 18:55:56 +0200
Subject: [PATCH] fix(dev): fix dev authentication pathway

---
 .../lib/data-access/authorization/useAuth.tsx | 20 ++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/libs/shared/lib/data-access/authorization/useAuth.tsx b/libs/shared/lib/data-access/authorization/useAuth.tsx
index a2a185421..2983c0b31 100644
--- a/libs/shared/lib/data-access/authorization/useAuth.tsx
+++ b/libs/shared/lib/data-access/authorization/useAuth.tsx
@@ -63,15 +63,17 @@ export const useAuth = () => {
   const fetchAuthenticated = (input: RequestInfo | URL, init?: RequestInit | undefined): Promise<Response> => {
     if (!init) init = fetchSettings;
 
-    init.credentials = 'include';
-    init.redirect = 'follow';
-    init.method = init.method || 'GET';
-    init.headers = {
-      'Content-Type': 'application/json',
-      sessionid: auth.sessionID || '',
-      //   Authorization: `Bearer ${auth.jwt}`,
-      ...init.headers,
-    };
+    if (!import.meta.env.SKIP_LOGIN) {
+      init.credentials = 'include';
+      init.redirect = 'follow';
+      init.method = init.method || 'GET';
+      init.headers = {
+        'Content-Type': 'application/json',
+        sessionid: auth.sessionID || '',
+        //   Authorization: `Bearer ${auth.jwt}`,
+        ...init.headers,
+      };
+    }
 
     return fetch(input, init);
   };
-- 
GitLab