From 0f6d5a20051423fde8e177befca09d2971f4fd82 Mon Sep 17 00:00:00 2001 From: rui hildt Date: Tue, 18 Aug 2020 17:43:15 +0200 Subject: [PATCH] Add Axios to handle requests + base configuration --- package-lock.json | 41 ++++++++++++++++++++++++++++++++++++----- package.json | 5 ++++- src/http-common.js | 10 ++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 src/http-common.js diff --git a/package-lock.json b/package-lock.json index c9de91d..6837f5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2708,6 +2708,37 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz", "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==" }, + "axios": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "requires": { + "follow-redirects": "1.5.10" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, "axobject-query": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", @@ -5793,11 +5824,6 @@ } } }, - "eslint-plugin-react-hooks": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz", - "integrity": "sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA==" - }, "eslint-scope": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", @@ -12831,6 +12857,11 @@ "workbox-webpack-plugin": "4.3.1" }, "dependencies": { + "eslint-plugin-react-hooks": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz", + "integrity": "sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA==" + }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", diff --git a/package.json b/package.json index 1a23483..ba290dd 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,9 @@ "@testing-library/jest-dom": "^5.11.3", "@testing-library/react": "^10.4.8", "@testing-library/user-event": "^12.1.1", + "axios": "^0.19.2", "customize-cra": "^1.0.0", + "dotenv": "^8.2.0", "fullcalendar-scheduler": "^5.3.0", "less": "^3.12.2", "less-loader": "^6.2.0", @@ -47,5 +49,6 @@ "last 1 chrome version", "last 1 safari version" ] - } + }, + "devDependencies": {} } diff --git a/src/http-common.js b/src/http-common.js new file mode 100644 index 0000000..ef8d231 --- /dev/null +++ b/src/http-common.js @@ -0,0 +1,10 @@ +import axios from 'axios'; + +export const API_URL = 'https://meeting-planner-backend.herokuapp.com'; + +export const my_app = axios.create({ + baseURL: API_URL, + headers: { + 'Content-type': 'application/json', + }, +});