ensure url is set before passing to URL constructor

This commit is contained in:
Karol Wypchlo 2022-02-02 19:22:09 +01:00
parent e2dfc8a36f
commit ad86704ac4
No known key found for this signature in database
GPG Key ID: B515DE9EEBE241E1
1 changed files with 1 additions and 1 deletions

View File

@ -3,7 +3,7 @@ import skynetClient from "./skynetClient";
export default function useAccountsUrl() {
const [url, setUrl] = React.useState("");
const createAccountsUrl = React.useCallback((path = "") => new URL(path, url).toString(), [url]);
const createAccountsUrl = React.useCallback((path = "") => url && new URL(path, url).toString(), [url]);
React.useEffect(() => {
(async function resolve() {