Skip to content

Commit

Permalink
fix: Signout API removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pritish Budhiraja committed Dec 20, 2023
1 parent 52933b4 commit b92a3c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/screens/HyperSwitch/APIUtils/APIUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ let getURL = (
let sessionExpired = ref(false)

let handleLogout = async (
~fetchApi: (
~fetchApi as _: (
Js.String2.t,
~bodyStr: string=?,
~headers: Js.Dict.t<Js.String2.t>=?,
Expand All @@ -249,8 +249,8 @@ let handleLogout = async (
) => Promise.t<Fetch.Response.t>,
~setAuthStatus,
) => {
let logoutUrl = getURL(~entityName=USERS, ~methodType=Post, ~userType=#SIGNOUT, ())
let _ = await fetchApi(logoutUrl, ~method_=Fetch.Post, ())
// let logoutUrl = getURL(~entityName=USERS, ~methodType=Post, ~userType=#SIGNOUT, ())
// let _ = await fetchApi(logoutUrl, ~method_=Fetch.Post, ())
setAuthStatus(HyperSwitchAuthTypes.LoggedOut)
LocalStorage.clear()
RescriptReactRouter.push("/register")
Expand Down
21 changes: 2 additions & 19 deletions src/screens/HyperSwitch/Sidebar/Sidebar.res
Original file line number Diff line number Diff line change
Expand Up @@ -524,25 +524,8 @@ let make = (

let transformClass = "transform md:translate-x-0 transition"

let handleLogout = _ev => {
open Promise
fetchApi(
APIUtils.getURL(~entityName=USERS, ~methodType=Post, ~userType=#SIGNOUT, ()),
~bodyStr=Js.Json.stringify(Js.Json.object_(Js.Dict.empty())),
~method_=Fetch.Post,
(),
)
->then(Fetch.Response.text)
->then(_ => {
setIsSidebarExpanded(_ => false)
LocalStorage.clear()
setAuthStatus(LoggedOut)
resolve()
})
->catch(_err => {
resolve()
})
->ignore
let handleLogout = _ => {
let _ = APIUtils.handleLogout(~fetchApi, ~setAuthStatus)
}

<div className={`bg-sidebar-blue flex group border-r border-jp-gray-500 relative`}>
Expand Down

0 comments on commit b92a3c9

Please sign in to comment.