Skip to content

Commit

Permalink
fix: fix issue with return url
Browse files Browse the repository at this point in the history
  • Loading branch information
mainawycliffe committed Nov 17, 2023
1 parent e68010c commit 47aeba7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/ory/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,13 @@ export function useCreateLogoutHandler(deps?: DependencyList) {
const [logoutToken, setLogoutToken] = useState<string>("");
const handleError = HandleError();
const { push } = useRouter();
const returnTo = window.location.pathname + window.location.search;

useEffect(() => {
ory
.createBrowserLogoutFlow()
.createBrowserLogoutFlow({
returnTo: returnTo
})
.then(({ data }) => {
setLogoutToken(data.logout_token);
})
Expand All @@ -187,7 +190,8 @@ export function useCreateLogoutHandler(deps?: DependencyList) {
if (logoutToken) {
ory
.updateLogoutFlow({
token: logoutToken
token: logoutToken,
returnTo: returnTo
})
.then(() => push("/"))
.catch((error) => {
Expand Down

0 comments on commit 47aeba7

Please sign in to comment.