Skip to content

Commit

Permalink
feat: signout api call (#583)
Browse files Browse the repository at this point in the history
Co-authored-by: Pritish Budhiraja <[email protected]>
  • Loading branch information
gitanjli525 and Pritish Budhiraja authored Apr 17, 2024
1 parent 0522921 commit f03f33f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/screens/APIUtils/APIUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ let getURL = (
let sessionExpired = ref(false)

let handleLogout = async (
~fetchApi as _: (
~fetchApi: (
string,
~bodyStr: string=?,
~bodyFormData: option<Fetch.formData>=?,
Expand All @@ -266,13 +266,17 @@ let handleLogout = async (
~setIsSidebarExpanded,
~clearRecoilValue,
) => {
// let logoutUrl = getURL(~entityName=USERS, ~methodType=Post, ~userType=#SIGNOUT, ())
// let _ = await fetchApi(logoutUrl, ~method_=Fetch.Post, ())
setAuthStatus(HyperSwitchAuthTypes.LoggedOut)
setIsSidebarExpanded(_ => false)
clearRecoilValue()
LocalStorage.clear()
RescriptReactRouter.push("/login")
try {
setAuthStatus(HyperSwitchAuthTypes.LoggedOut)
setIsSidebarExpanded(_ => false)
clearRecoilValue()
RescriptReactRouter.push("/login")
let logoutUrl = getURL(~entityName=USERS, ~methodType=Post, ~userType=#SIGNOUT, ())
let _ = await fetchApi(logoutUrl, ~method_=Fetch.Post, ())
LocalStorage.clear()
} catch {
| _ => LocalStorage.clear()
}
}

let responseHandler = async (
Expand Down

0 comments on commit f03f33f

Please sign in to comment.