0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(console): input verification code in profile page should not crash the app (#4489)

* fix(console): input verification code in profile page should not crash the app

* chore: add changeset
This commit is contained in:
Charles Zhao 2023-09-12 21:38:37 +08:00 committed by GitHub
parent fa8ac7761d
commit 18e05586cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"@logto/console": patch
---
fix the app crash when inputting verification code in Console profile page

View file

@ -1,5 +1,6 @@
import { ossConsolePath } from '@logto/schemas';
import { conditionalArray, joinPath } from '@silverhand/essentials';
import { useMemo } from 'react';
import { useHref } from 'react-router-dom';
import { isCloud } from '@/consts/env';
@ -13,8 +14,9 @@ const useRedirectUri = (flow: 'signIn' | 'signOut' = 'signIn') => {
const path = useHref(
joinPath(...conditionalArray(!isCloud && ossConsolePath, flow === 'signIn' ? '/callback' : '/'))
);
const url = useMemo(() => new URL(path, window.location.origin), [path]);
return new URL(path, window.location.origin);
return url;
};
export default useRedirectUri;