From 2facd8f67a3731c50685de36edd59a11a0fe652c Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 19 Apr 2023 15:15:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AElocation.host=E5=88=A4?= =?UTF-8?q?=E6=96=ADapi=E7=9A=84host?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scripts/confirm.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/scripts/confirm.js b/assets/scripts/confirm.js index dfa3333..28832d1 100644 --- a/assets/scripts/confirm.js +++ b/assets/scripts/confirm.js @@ -1,5 +1,6 @@ const { createApp } = Vue; const API_BASE = "https://xwork.kingsome.cn"; +const API_BASE_LOCAL = "http://localhost:3002"; const TASK_INFO_URL = "/workflow/task"; const DEFAULT_CHAIN_DATA = { @@ -53,7 +54,8 @@ async function connectMetaMask() { } const fetchTaskInfo = function (taskId) { - const url = `${API_BASE}${TASK_INFO_URL}/${taskId}`; + const host = location.host === "localhost" ? API_BASE_LOCAL : API_BASE; + const url = `${host}${TASK_INFO_URL}/${taskId}`; return fetch(url) .then((response) => { if (!response.ok) {