From 8148343115d26d3a418bd50c5e1ae1ec9496bb82 Mon Sep 17 00:00:00 2001 From: Willian Viana Date: Tue, 30 Jan 2024 12:35:59 -0300 Subject: [PATCH 1/2] chore(axios): bump axios to 1.6.7 --- package.json | 2 +- utils/request.js | 30 +++++++++++++++++++++--------- yarn.lock | 21 ++++++++++++++++++++- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 8a70203212..d27135eeef 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@wordpress/api-fetch": "^3.19.1", "@worldresources/gfw-components": "^3.5.0", "aws-sdk": "^2.291.0", - "axios": "^0.21.1", + "axios": "1.6.7", "chroma-js": "^2.1.0", "classnames": "^2.2.6", "cookie": "^0.4.1", diff --git a/utils/request.js b/utils/request.js index 931fad51d0..921535d1ee 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,4 +1,4 @@ -import { CancelToken, create } from 'axios'; +import axios, { CancelToken } from 'axios'; import wriAPISerializer from 'wri-json-api-serializer'; import { @@ -27,7 +27,9 @@ const RESOURCE_WATCH_API_URL = RESOURCE_WATCH_API; // At the moment, the API key is the same const GFW_API_KEY = process.env.NEXT_PUBLIC_GFW_API_KEY; +const GFW_METADATA_API_KEY = GFW_API_KEY; const DATA_API_KEY = GFW_API_KEY; +const RESOURCE_WATCH_API_KEY = GFW_API_KEY; const isServer = typeof window === 'undefined'; @@ -35,17 +37,20 @@ const defaultRequestConfig = { timeout: 30 * 1000, }; -export const apiRequest = create({ +export const apiRequest = axios.create({ ...defaultRequestConfig, ...(isServer && { baseURL: GFW_API_URL, + headers: { + 'x-api-key': GFW_API_KEY, + }, }), ...(!isServer && { baseURL: PROXIES.GFW_API, }), }); -export const dataRequest = create({ +export const dataRequest = axios.create({ ...defaultRequestConfig, ...(isServer && { baseURL: DATA_API_URL, @@ -59,20 +64,26 @@ export const dataRequest = create({ transformResponse: [(data) => JSON.parse(data)?.data], }); -export const metadataRequest = create({ +export const metadataRequest = axios.create({ ...defaultRequestConfig, ...(isServer && { baseURL: GFW_METADATA_API_URL, + headers: { + 'x-api-key': GFW_METADATA_API_KEY, + }, }), ...(!isServer && { baseURL: PROXIES.METADATA_API, }), }); -export const rwRequest = create({ +export const rwRequest = axios.create({ ...defaultRequestConfig, ...(isServer && { baseURL: RESOURCE_WATCH_API_URL, + headers: { + 'x-api-key': RESOURCE_WATCH_API_KEY, + }, }), ...(!isServer && { baseURL: PROXIES.RESOURCE_WATCH_API, @@ -80,12 +91,13 @@ export const rwRequest = create({ transformResponse: [(data) => wriAPISerializer(JSON.parse(data))], }); -export const apiAuthRequest = create({ +export const apiAuthRequest = axios.create({ ...defaultRequestConfig, ...(isServer && { baseURL: GFW_API, headers: { 'content-type': 'application/json', + 'x-api-key': GFW_API_KEY, }, }), ...(!isServer && { @@ -97,18 +109,18 @@ export const apiAuthRequest = create({ }), }); -export const cartoRequest = create({ +export const cartoRequest = axios.create({ ...defaultRequestConfig, baseURL: CARTO_API, }); -export const mapboxRequest = create({ +export const mapboxRequest = axios.create({ ...defaultRequestConfig, baseURL: MAPBOX_API, }); export const cancelToken = () => CancelToken.source(); -export default create({ +export default axios.create({ ...defaultRequestConfig, }); diff --git a/yarn.lock b/yarn.lock index 82cc2d89da..449438fb22 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4573,13 +4573,22 @@ axe-core@^4.6.2: resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.7.2.tgz#040a7342b20765cb18bb50b628394c21bccc17a0" integrity sha512-zIURGIS1E1Q4pcrMjp+nnEh+16G56eG/MUllJH8yEvw7asDo7Ac9uhC9KIH5jzpITueEZolfYglnCGIuSBz39g== -axios@0.21.4, axios@^0.21.1: +axios@0.21.4: version "0.21.4" resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== dependencies: follow-redirects "^1.14.0" +axios@1.6.7: + version "1.6.7" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.7.tgz#7b48c2e27c96f9c68a2f8f31e2ab19f59b06b0a7" + integrity sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA== + dependencies: + follow-redirects "^1.15.4" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + axios@^0.19.0, axios@^0.19.2: version "0.19.2" resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27" @@ -8398,6 +8407,11 @@ follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.9: resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== +follow-redirects@^1.15.4: + version "1.15.5" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020" + integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw== + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -13844,6 +13858,11 @@ proxy-from-env@1.0.0: resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" integrity sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A== +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + ps-tree@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/ps-tree/-/ps-tree-1.2.0.tgz#5e7425b89508736cdd4f2224d028f7bb3f722ebd" From 0b969da4c567c341480c2ce6082366754df1c13e Mon Sep 17 00:00:00 2001 From: Luis Zenteno Date: Mon, 19 Feb 2024 10:01:23 -0500 Subject: [PATCH 2/2] feat(links): remove Community Forum link and bump gfw components version --- components/header/config.js | 6 +----- package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/components/header/config.js b/components/header/config.js index 23ad3fdd0e..619058ddbe 100644 --- a/components/header/config.js +++ b/components/header/config.js @@ -12,7 +12,7 @@ export default { isVisibleOnMobile: false, submenu: [ { - label: 'Tutorials', + label: 'Help Center', href: '/help/', }, /* // TODO: enable these 2 links when we have the real urls @@ -25,10 +25,6 @@ export default { href: '/faq/', }, */ - { - label: 'Community Forum', - extLink: 'https://groups.google.com/forum/#!forum/globalforestwatch/', - }, { label: 'Grants & Opportunities', href: '/grants-and-fellowships/projects/', diff --git a/package.json b/package.json index d27135eeef..a07261d2b2 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "@next/bundle-analyzer": "^10.0.1", "@reduxjs/toolkit": "^1.4.0", "@wordpress/api-fetch": "^3.19.1", - "@worldresources/gfw-components": "^3.5.0", + "@worldresources/gfw-components": "^3.5.4", "aws-sdk": "^2.291.0", "axios": "1.6.7", "chroma-js": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index 449438fb22..c94dc4808c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3945,10 +3945,10 @@ lodash "^4.17.19" react-native-url-polyfill "^1.1.2" -"@worldresources/gfw-components@^3.5.0": - version "3.5.0" - resolved "https://registry.yarnpkg.com/@worldresources/gfw-components/-/gfw-components-3.5.0.tgz#e2069f334fbbfd67aa8d881f8ea3407a06ff7fc8" - integrity sha512-/Hx1Zg17PTi4yZSxxIB4oDyHaxQ5YxEopn5WoTHZdDBytCmeJGaaTRbypA7wHZMEkgxN2ywSCTVyeX68p80N3g== +"@worldresources/gfw-components@^3.5.4": + version "3.5.4" + resolved "https://registry.yarnpkg.com/@worldresources/gfw-components/-/gfw-components-3.5.4.tgz#1d1d74073c0bf70a34e94294bf8b7e2e8d9ed5ec" + integrity sha512-//OAjp3RmHw0yO/V4FTgEkJvuzj2olnQou3ygdWjWy0wnPgoBUV2aTwfUGcnBX7kQt8WBz2kFtp8ZxC8mRtNJQ== dependencies: "@artsy/fresnel" "^1.1.0" "@tippyjs/react" "^4.0.2"