From e34e66172272b1018ef49d317d56adf46b0f6a09 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 29 Oct 2024 11:39:18 -0400 Subject: [PATCH] handler tweaks (#221) --- agent/agentUi/src/model/handler.js | 32 ++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/agent/agentUi/src/model/handler.js b/agent/agentUi/src/model/handler.js index 9731a41c..a94e2a14 100644 --- a/agent/agentUi/src/model/handler.js +++ b/agent/agentUi/src/model/handler.js @@ -1,39 +1,49 @@ import {AgentApi, ApiClient} from "../api/src/index.js"; export const getAgentApi = () => { - return new AgentApi(new ApiClient("http://localhost:5173")); + return new AgentApi(new ApiClient(window.location.origin)); } export const createShare = (opts) => { switch(opts.shareMode) { case "public": getAgentApi().agentSharePublic(opts, (e, d) => { - console.log("createShare", e, d); + if(e) { + console.log("createShare", e, d); + } }); break; case "private": getAgentApi().agentSharePrivate(opts, (e, d) => { - console.log("createShare", e, d); - }) + if(e) { + console.log("createShare", e, d); + } + }); break; } } export const releaseShare = (opts) => { getAgentApi().agentReleaseShare(opts, (e, d) => { - console.log("releaseShare", e, d); - }) + if(e) { + console.log("releaseShare", e, d); + } + }); } export const createAccess = (opts) => { getAgentApi().agentAccessPrivate(opts, (e, d) => { - console.log("createAccess", e, d); - }) + if(e) { + console.log("createAccess", e, d); + } + }); } export const releaseAccess = (opts) => { - getAgentApi().agentReleaseAccess(opts, (e, d) => { - console.log("releaseAccess", e, d); - }) + if(e) { + getAgentApi().agentReleaseAccess(opts, (e, d) => { + console.log("releaseAccess", e, d); + }); + } } \ No newline at end of file