Skip to content

Commit

Permalink
fix: enums
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 committed Dec 22, 2023
1 parent 8ae2fce commit a56f7bc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
10 changes: 9 additions & 1 deletion src/entryPoints/hyperswitch/HyperSwitchApp.res
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,15 @@ let make = () => {
let url = #ProductionAgreement->ProdOnboardingUtils.getProdOnboardingUrl
let response = await fetchDetails(url)

if response->getDictFromJsonObject->getBool("ProductionAgreement", false) {
let productionAgreementResponse =
response
->getArrayFromJson([])
->Js.Array2.find(ele => {
ele->getDictFromJsonObject->getBool("ProductionAgreement", false)
})
->Option.getWithDefault(Js.Json.null)

if productionAgreementResponse->getDictFromJsonObject->getBool("ProductionAgreement", false) {
setDashboardPageState(_ => #PROD_ONBOARDING)
} else {
setDashboardPageState(_ => #AGREEMENT_SIGNATURE)
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/AuthHooks.res
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ let getHeaders = (~uri, ~headers, ()) => {
"Authorization": `Bearer ${hyperSwitchToken->Belt.Option.getWithDefault("")}`,
"api-key": "hyperswitch",
}
Js.log2(headerObj, "headerObjheaderObjheaderObjheaderObj")
Fetch.HeadersInit.make(headerObj)
} else {
let headerObj = {
Expand All @@ -66,6 +65,7 @@ let getHeaders = (~uri, ~headers, ()) => {
| None =>
let headerObj = {
"Content-Type": "application/json",
"x-feature": "hyperswitch-custom",
}
Fetch.HeadersInit.make(headerObj)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,14 @@ let make = () => {
try {
let url = #SetupProcessor->ProdOnboardingUtils.getProdOnboardingUrl
let response = await fetchDetails(url)
let connectorId =
let setupProcessorEnum =
response
->getDictFromJsonObject
->getJsonObjectFromDict("SetupProcessor")
->getDictFromJsonObject
->getString("connector_id", "")
->getArrayFromJson([])
->Js.Array2.find(ele => {
ele->getDictFromJsonObject->getBool("SetupProcessor", false)
})
->Option.getWithDefault(Js.Json.null)
let connectorId = setupProcessorEnum->getDictFromJsonObject->getString("connector_id", "")
if connectorId->Js.String2.length > 0 {
setConnectorID(_ => connectorId)
getConfigureEndpointEnum()->ignore
Expand Down

0 comments on commit a56f7bc

Please sign in to comment.