From 99e35e35e39d90719d1c56ba1af3049298dd39a9 Mon Sep 17 00:00:00 2001 From: gregsantos Date: Mon, 24 Oct 2022 09:23:49 -0700 Subject: [PATCH] update: add conditional for wc and discovery api --- flow/config.js | 8 ++++---- pages/index.js | 10 +++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/flow/config.js b/flow/config.js index c57c74f..c1817af 100644 --- a/flow/config.js +++ b/flow/config.js @@ -32,10 +32,10 @@ if (USE_LOCAL) { .put("flow.network", "local") .put("accessNode.api", "http://localhost:8888") // dev-wallet - // .put("discovery.wallet", "http://localhost:8701/fcl/authn") - // local discovery - .put("discovery.wallet", "http://localhost:3002/local/authn") - .put("discovery.authn.endpoint", "http://localhost:3002/api/local/authn") + .put("discovery.wallet", "http://localhost:8701/fcl/authn") + // local discovery + // .put("discovery.wallet", "http://localhost:3002/local/authn") + // .put("discovery.authn.endpoint", "http://localhost:3002/api/local/authn") } else { // prettier-ignore fcl diff --git a/pages/index.js b/pages/index.js index 2cfb519..0e65d71 100644 --- a/pages/index.js +++ b/pages/index.js @@ -41,16 +41,20 @@ export default function Home() { }) fcl.pluginRegistry.add(FclWcServicePlugin) } - if (process.env.NEXT_PUBLIC_WC_PROJECT_ID) initAdapter() + if ( + config && + config.flow.network !== "local" && + process.env.NEXT_PUBLIC_WC_PROJECT_ID + ) + initAdapter() }, []) useEffect(() => { const fetchServices = async () => await fcl.discovery.authn.subscribe(res => { - console.log("discovery api services", res) setServices(res.results) }) - fetchServices() + if (config && config.discovery.authn.endpoint) fetchServices() }, []) useEffect(() => {