From 9b8a509eda053bc18df5adb2226650e88ab1d5db Mon Sep 17 00:00:00 2001 From: peeech Date: Mon, 1 Jul 2024 17:16:10 +0200 Subject: [PATCH] update urls holochain-api => api --- README.md | 2 +- mock-hpos-api/defaultResponse.js | 20 ++++++++++---------- src/interfaces/HposInterface.ts | 2 +- vite.config.ts | 4 ---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index a9e787b8..a6340934 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Start UI server yarn serve ``` -Using this command, all requests to `localhost:8080/api/` and `localhost:8080/holochain-api/` are forwarded to the holoport. This is really helpful for development/testing. +Using this command, all requests to `localhost:8080/api/` are forwarded to the holoport. This is really helpful for development/testing. If you want to run it against mocked data you will need to run it as below. diff --git a/mock-hpos-api/defaultResponse.js b/mock-hpos-api/defaultResponse.js index c5544e56..cf60b0e1 100644 --- a/mock-hpos-api/defaultResponse.js +++ b/mock-hpos-api/defaultResponse.js @@ -639,27 +639,27 @@ let mockDefaultHappPreferences = { price_storage: (Math.random() * 10).toFixed(5).toString() } -// NB: both /api and /holochain-api calls are mocked here +// NB: both /api calls are mocked here const data = { get: { '/api/v1/config': userConfig, '/api/v1/status': holoNixpkgs, '/api/v2/apps/hosted': happs, - '/holochain-api/v1/get_happs': mockHapps, - '/holochain-api/v1/get_hosts': mockHosts, - '/holochain-api/v2/holoport/usage': usage, - '/holochain-api/v2/host/earnings': earnings, - '/holochain-api/v2/apps/core/version': coreAppVersion, - '/holochain-api/v2/host/invoices': mockPaidInvoicesData, - '/holochain-api/v2/host/redemptions': mockRedemptionHistoryData, - '/holochain-api/v2/host/kyc': mockKycData.kyc + '/api/v1/get_happs': mockHapps, + '/api/v1/get_hosts': mockHosts, + '/api/v2/holoport/usage': usage, + '/api/v2/host/earnings': earnings, + '/api/v2/apps/core/version': coreAppVersion, + '/api/v2/host/invoices': mockPaidInvoicesData, + '/api/v2/host/redemptions': mockRedemptionHistoryData, + '/api/v2/host/kyc': mockKycData.kyc }, put: { '/api/v1/config': (args) => args, '/api/v1/holoport/name': {} }, post: { - '/holochain-api/v1/apps/call_zome': (args) => { + '/api/v2/apps/call_zome': (args) => { switch (args.fnName) { case 'get_my_profile': return getMyProfile diff --git a/src/interfaces/HposInterface.ts b/src/interfaces/HposInterface.ts index d3526f36..5a4929b7 100644 --- a/src/interfaces/HposInterface.ts +++ b/src/interfaces/HposInterface.ts @@ -421,7 +421,7 @@ export function useHposInterface(): HposInterface { // On 401 redirect to login and unset authToken because the reason for 401 might be it's expired try { return await hposCall({ - pathPrefix: '/holochain-api/v2', + pathPrefix: '/api/v2', ...args }) } catch (err) { diff --git a/vite.config.ts b/vite.config.ts index 8bcbfaaa..5d21e869 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -51,10 +51,6 @@ export default defineConfig(({ mode }) => { port: 8080, proxy: { '^/api/*': { - target: env.VITE_HOLOPORT_URL, - changeOrigin: true - }, - '^/holochain-api/*': { target: env.VITE_HOLOPORT_URL, changeOrigin: true }