From af9465a49454c9effec8854ce765638f86619ec5 Mon Sep 17 00:00:00 2001 From: deanchen Date: Tue, 16 Nov 2021 15:36:06 +0800 Subject: [PATCH] feat: migrate to web map client mock server --- README.md | 12 +----- ...pp.yaml => depricated-wallet-web-app.yaml} | 0 src/App.js | 2 +- src/components/MapDrawer.js | 4 +- yarn.lock | 42 +++++++++++++++++++ 5 files changed, 47 insertions(+), 13 deletions(-) rename doc/{wallet-web-app.yaml => depricated-wallet-web-app.yaml} (100%) diff --git a/README.md b/README.md index ada6018..9be0654 100644 --- a/README.md +++ b/README.md @@ -72,17 +72,9 @@ npm run cy ## The API -We got another team working on the API endpoint, so the API spec is evolving. This is the current API specification: +Now we are going to combine the API of wallet API with the web map client API, so we deprecated the API and mock server under `doc` folder. Instead, you need to run the mock server from `treetracker-web-map-client` repo. Please download that repo and run the mock server: `npm run mock-server`. -[API spec](/doc/wallet-web-app.yaml) - -To check the doc in a convenient way, please import it to some API tools like: http://editor.swagger.io/ or Postman. - -To import the API doc to Postman or Swagger (both work the same), simply just click on the 'File' tab in the menubar and look for the 'Import' option. Find the API .yaml file in your local repository inside the doc directory and click 'Open'. - -### Using our mock API server - -Refer to [here](https://github.com/Greenstand/treetracker-web-map-client/blob/web-map-site/README.md#using-our-mock-api-server) +The details is here: https://github.com/Greenstand/treetracker-web-map-client#the-api ### Config diff --git a/doc/wallet-web-app.yaml b/doc/depricated-wallet-web-app.yaml similarity index 100% rename from doc/wallet-web-app.yaml rename to doc/depricated-wallet-web-app.yaml diff --git a/src/App.js b/src/App.js index f9d7d7a..f671afa 100644 --- a/src/App.js +++ b/src/App.js @@ -32,7 +32,7 @@ function LandingPage() { function handleClick() { log.debug('load finished'); - history.push('/wallets/stephanie'); + history.push('/wallets/180Earth'); } return ( diff --git a/src/components/MapDrawer.js b/src/components/MapDrawer.js index 91b3e43..2443ed9 100644 --- a/src/components/MapDrawer.js +++ b/src/components/MapDrawer.js @@ -106,11 +106,11 @@ function MapDrawer(props) { const getWalletData = async () => { let response = await axios.request({ - url: `${process.env.REACT_APP_API_WALLET}/wallets/SustainablyRun`, + url: `${process.env.REACT_APP_API_WALLET}/wallets/180Earth`, }); setWallet(response.data); response = await axios.request({ - url: `${process.env.REACT_APP_API_WALLET}/wallets/SustainablyRun/tokens`, + url: `${process.env.REACT_APP_API_WALLET}/tokens/query/wallet=180Earth&withPlanter=true&withCapture=true`, }); setTokens(response.data.tokens); log.warn('loaded wallet:', wallet); diff --git a/yarn.lock b/yarn.lock index 6a7d196..65b0cd8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4706,6 +4706,13 @@ "resolved" "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz" "version" "2.2.0" +"bindings@^1.5.0": + "integrity" "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==" + "resolved" "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz" + "version" "1.5.0" + dependencies: + "file-uri-to-path" "1.0.0" + "blob-util@^2.0.2": "integrity" "sha512-T7JQa+zsXXEa6/8ZhHcQEW1UFfVM49Ts65uBkFL6fz2QmrElqmbajIDJvuA0tEhRe5eIjpV9ZF+0RfZR9voJFQ==" "resolved" "https://registry.npmjs.org/blob-util/-/blob-util-2.0.2.tgz" @@ -8635,6 +8642,29 @@ "resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" "version" "1.0.0" +"fsevents@^1.2.7": + "integrity" "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==" + "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz" + "version" "1.2.13" + dependencies: + "bindings" "^1.5.0" + "nan" "^2.12.1" + +"fsevents@^2.1.2", "fsevents@2.1.2": + "integrity" "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==" + "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz" + "version" "2.1.2" + +"fsevents@^2.1.3": + "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==" + "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" + "version" "2.3.2" + +"fsevents@~2.3.2": + "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==" + "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" + "version" "2.3.2" + "function-bind@^1.1.1": "integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" "resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" @@ -12250,6 +12280,11 @@ "resolved" "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz" "version" "0.0.8" +"nan@^2.12.1": + "integrity" "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==" + "resolved" "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz" + "version" "2.15.0" + "nanoid@^3.1.23": "integrity" "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==" "resolved" "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz" @@ -17230,6 +17265,13 @@ dependencies: "makeerror" "1.0.x" +"watchpack-chokidar2@^2.0.1": + "integrity" "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==" + "resolved" "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz" + "version" "2.0.1" + dependencies: + "chokidar" "^2.1.8" + "watchpack@^1.6.0", "watchpack@^1.7.4": "integrity" "sha512-9P3MWk6SrKjHsGkLT2KHXdQ/9SNkyoJbabxnKOoJepsvJjJG8uYTR3yTPxPQvNDI3w4Nz1xnE0TLHK4RIVe/MQ==" "resolved" "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz"