Skip to content

Commit

Permalink
fix: x-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 committed Dec 22, 2023
1 parent f079b96 commit 8ae2fce
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/hooks/AuthHooks.res
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ let getHeaders = (~uri, ~headers, ()) => {
let hyperSwitchToken = LocalStorage.getItem("login")->Js.Nullable.toOption
let isMixpanel = uri->Js.String2.includes("mixpanel")

Js.log2(uri, "uri")

if isMixpanel {
let headerObj = {
"Content-Type": "application/x-www-form-urlencoded",
Expand All @@ -34,14 +36,26 @@ let getHeaders = (~uri, ~headers, ()) => {
switch hyperSwitchToken {
| Some(token) =>
if token !== "" {
let headerObj = {
"Content-Type": "application/json",
"Authorization": `Bearer ${hyperSwitchToken->Belt.Option.getWithDefault("")}`,
"api-key": "hyperswitch",
"x-feature": "hyperswitch-custom",
if (
uri->Js.String2.includes("lottie-files") ||
uri->Js.String2.includes("config/merchant-access")
) {
let headerObj = {
"Content-Type": "application/json",
"Authorization": `Bearer ${hyperSwitchToken->Belt.Option.getWithDefault("")}`,
"api-key": "hyperswitch",
}
Js.log2(headerObj, "headerObjheaderObjheaderObjheaderObj")
Fetch.HeadersInit.make(headerObj)
} else {
let headerObj = {
"Content-Type": "application/json",
"Authorization": `Bearer ${hyperSwitchToken->Belt.Option.getWithDefault("")}`,
"api-key": "hyperswitch",
"x-feature": "hyperswitch-custom",
}
Fetch.HeadersInit.make(headerObj)
}

Fetch.HeadersInit.make(headerObj)
} else {
let headerObj = {
"Content-Type": "application/json",
Expand Down

0 comments on commit 8ae2fce

Please sign in to comment.