ensure url is set before passing to URL constructor
This commit is contained in:
parent
e2dfc8a36f
commit
ad86704ac4
|
@ -3,7 +3,7 @@ import skynetClient from "./skynetClient";
|
||||||
|
|
||||||
export default function useAccountsUrl() {
|
export default function useAccountsUrl() {
|
||||||
const [url, setUrl] = React.useState("");
|
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(() => {
|
React.useEffect(() => {
|
||||||
(async function resolve() {
|
(async function resolve() {
|
||||||
|
|
Reference in New Issue