Commit 29bfba43 authored by David Björkheim's avatar David Björkheim Committed by Oyvind
Browse files

DEICH-5645 Deichman.no: Remove unfetch

parent 2a1485c3
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"": { "": {
"name": "deichman-next", "name": "deichman-next",
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "GPL-3.0-only",
"dependencies": { "dependencies": {
"@digibib/deichman-ui": "^7.2.2", "@digibib/deichman-ui": "^7.2.2",
"@nrk/core-tabs": "^2.0.6", "@nrk/core-tabs": "^2.0.6",
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
"formik": "^2.2.6", "formik": "^2.2.6",
"full-icu": "^1.2.1", "full-icu": "^1.2.1",
"helmet": "^4.1.1", "helmet": "^4.1.1",
"isomorphic-unfetch": "^3.0.0",
"jsonld": "^5.0.0", "jsonld": "^5.0.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"lodash": "^4.17.20", "lodash": "^4.17.20",
...@@ -7599,15 +7598,6 @@ ...@@ -7599,15 +7598,6 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/isomorphic-unfetch": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz",
"integrity": "sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==",
"dependencies": {
"node-fetch": "^2.6.1",
"unfetch": "^4.2.0"
}
},
"node_modules/jest-worker": { "node_modules/jest-worker": {
"version": "24.9.0", "version": "24.9.0",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz",
...@@ -19574,11 +19564,6 @@ ...@@ -19574,11 +19564,6 @@
"debug": "^2.2.0" "debug": "^2.2.0"
} }
}, },
"node_modules/unfetch": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz",
"integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA=="
},
"node_modules/union-value": { "node_modules/union-value": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
...@@ -27438,15 +27423,6 @@ ...@@ -27438,15 +27423,6 @@
"isarray": "1.0.0" "isarray": "1.0.0"
} }
}, },
"isomorphic-unfetch": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz",
"integrity": "sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==",
"requires": {
"node-fetch": "^2.6.1",
"unfetch": "^4.2.0"
}
},
"jest-worker": { "jest-worker": {
"version": "24.9.0", "version": "24.9.0",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz",
...@@ -37251,11 +37227,6 @@ ...@@ -37251,11 +37227,6 @@
"debug": "^2.2.0" "debug": "^2.2.0"
} }
}, },
"unfetch": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz",
"integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA=="
},
"union-value": { "union-value": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
"formik": "^2.2.6", "formik": "^2.2.6",
"full-icu": "^1.2.1", "full-icu": "^1.2.1",
"helmet": "^4.1.1", "helmet": "^4.1.1",
"isomorphic-unfetch": "^3.0.0",
"jsonld": "^5.0.0", "jsonld": "^5.0.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"lodash": "^4.17.20", "lodash": "^4.17.20",
......
import "isomorphic-unfetch";
import React, { Component, Fragment } from "react"; import React, { Component, Fragment } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { connect } from "react-redux"; import { connect } from "react-redux";
......
import "isomorphic-unfetch";
import React, { Component, Fragment } from "react"; import React, { Component, Fragment } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { connect } from "react-redux"; import { connect } from "react-redux";
......
import "isomorphic-unfetch";
import React, { Component, Fragment } from "react"; import React, { Component, Fragment } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { connect } from "react-redux"; import { connect } from "react-redux";
...@@ -31,12 +30,13 @@ class ListPage extends Component { ...@@ -31,12 +30,13 @@ class ListPage extends Component {
"field.status": "published" "field.status": "published"
}; };
// Determine what mediatype to display // Determine what mediatype to display
const mediaTypeQuery = URL_TO_QUERY_MAP[mediaType]; const mediaTypeQuery = URL_TO_QUERY_MAP[mediaType];
const invalidMediaType = mediaTypeQuery === undefined; const invalidMediaType = mediaTypeQuery === undefined;
await reduxStore.dispatch(getLists(req, queryWithFilter, mediaTypeQuery, page)); await reduxStore.dispatch(
getLists(req, queryWithFilter, mediaTypeQuery, page)
);
return { return {
mediaType, mediaType,
......
import "isomorphic-unfetch";
import React, { Component, Fragment } from "react"; import React, { Component, Fragment } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { connect } from "react-redux"; import { connect } from "react-redux";
......
import "isomorphic-unfetch";
import React, { Component, Fragment } from "react"; import React, { Component, Fragment } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { connect } from "react-redux"; import { connect } from "react-redux";
......
import "isomorphic-unfetch";
import React, { Component, Fragment } from "react"; import React, { Component, Fragment } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { connect } from "react-redux"; import { connect } from "react-redux";
......
import "isomorphic-unfetch";
import React, { Component, Fragment } from "react"; import React, { Component, Fragment } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { connect } from "react-redux"; import { connect } from "react-redux";
......
import "isomorphic-unfetch";
import React, { Component, Fragment } from "react"; import React, { Component, Fragment } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { connect } from "react-redux"; import { connect } from "react-redux";
...@@ -149,7 +148,14 @@ SearchPage.propTypes = { ...@@ -149,7 +148,14 @@ SearchPage.propTypes = {
function mapStateToProps(state) { function mapStateToProps(state) {
const { listMode } = state.application; const { listMode } = state.application;
const { biblioNumbers } = state.favourites; const { biblioNumbers } = state.favourites;
const { currentQuery, results, overlayVisible, searchApi, agentResults, agentSearchApi } = state.search; const {
currentQuery,
results,
overlayVisible,
searchApi,
agentResults,
agentSearchApi
} = state.search;
return { return {
favourites: biblioNumbers, favourites: biblioNumbers,
overlayVisible, overlayVisible,
......
/* eslint-disable camelcase */ /* eslint-disable camelcase */
const fetch = require("isomorphic-unfetch");
const router = require("express").Router(); const router = require("express").Router();
const jwt = require("jsonwebtoken"); const jwt = require("jsonwebtoken");
const { verifyToken } = require("../utils/tokenChecker"); const { verifyToken } = require("../utils/tokenChecker");
......
const routes = require("express").Router(); const routes = require("express").Router();
const fetch = require("isomorphic-unfetch");
const QueryString = require("query-string"); const QueryString = require("query-string");
const logger = require("../../logger")(__filename); const logger = require("../../logger")(__filename);
......
const isofetch = require("isomorphic-unfetch");
const fetch = require("isomorphic-unfetch");
const { parseString } = require("xml2js"); const { parseString } = require("xml2js");
const router = require("express").Router(); const router = require("express").Router();
const cookieParser = require("../utils/cookieParser"); const cookieParser = require("../utils/cookieParser");
...@@ -190,7 +188,7 @@ router.post("/start-pay-fine", async (request, response) => { ...@@ -190,7 +188,7 @@ router.post("/start-pay-fine", async (request, response) => {
} }
} }
const res = await isofetch(registerUrl); const res = await fetch(registerUrl);
const xmlResponse = await res.text(); const xmlResponse = await res.text();
const jsonResponse = await xml2jsPromiseParser(xmlResponse); const jsonResponse = await xml2jsPromiseParser(xmlResponse);
const transactionId = jsonResponse.RegisterResponse.TransactionId; const transactionId = jsonResponse.RegisterResponse.TransactionId;
...@@ -261,7 +259,7 @@ router.put("/process-fine-payment", async (request, response) => { ...@@ -261,7 +259,7 @@ router.put("/process-fine-payment", async (request, response) => {
call_id: deichmanCallId call_id: deichmanCallId
} }
); );
const res = await isofetch(processUrl); const res = await fetch(processUrl);
const xmlResponse = await res.text(); const xmlResponse = await res.text();
const jsonResponse = await xml2jsPromiseParser(xmlResponse); const jsonResponse = await xml2jsPromiseParser(xmlResponse);
......
const router = require("express").Router(); const router = require("express").Router();
const fetch = require("isomorphic-unfetch");
const kohaEndpoint = process.env.INTERNAL_URL_KOHA; const kohaEndpoint = process.env.INTERNAL_URL_KOHA;
......
const resources = require("express").Router(); const resources = require("express").Router();
const fetch = require("isomorphic-unfetch");
const cookieParser = require("../utils/cookieParser"); const cookieParser = require("../utils/cookieParser");
const logger = require("../../logger")(__filename); const logger = require("../../logger")(__filename);
......
const router = require("express").Router(); const router = require("express").Router();
const jwt = require("jsonwebtoken"); const jwt = require("jsonwebtoken");
const fetch = require("isomorphic-unfetch");
const logger = require("../../logger")(__filename); const logger = require("../../logger")(__filename);
const { verifyToken } = require("../utils/tokenChecker"); const { verifyToken } = require("../utils/tokenChecker");
......
const routes = require("express").Router(); const routes = require("express").Router();
const fetch = require("isomorphic-unfetch");
const logger = require("../../logger")(__filename); const logger = require("../../logger")(__filename);
const format = require("date-fns/format"); const format = require("date-fns/format");
const { const {
...@@ -71,7 +70,7 @@ function filterLibraries(libraries, categorycode) { ...@@ -71,7 +70,7 @@ function filterLibraries(libraries, categorycode) {
"fsme", "fsme",
"fsto", "fsto",
"ftor", "ftor",
"fgam", "fgam"
].includes(l.branchcode) ].includes(l.branchcode)
) { ) {
return true; return true;
...@@ -79,7 +78,6 @@ function filterLibraries(libraries, categorycode) { ...@@ -79,7 +78,6 @@ function filterLibraries(libraries, categorycode) {
// allow test branch codes also // allow test branch codes also
return /^[a-f0-9]{8}$/.test(l.branchcode); return /^[a-f0-9]{8}$/.test(l.branchcode);
}); });
} }
...@@ -94,7 +92,9 @@ routes.get("/koha-branches", async (request, response) => { ...@@ -94,7 +92,9 @@ routes.get("/koha-branches", async (request, response) => {
response.status(res.status).send(res.statusText); response.status(res.status).send(res.statusText);
throw Error(); throw Error();
} }
response.status(200).send(filterLibraries(json, request.query.categorycode)); response
.status(200)
.send(filterLibraries(json, request.query.categorycode));
} catch (error) { } catch (error) {
logger.info(`ERROR in fetchin all libraries; ${error}`, { logger.info(`ERROR in fetchin all libraries; ${error}`, {
...error, ...error,
......
const fetch = require("isomorphic-unfetch");
const router = require("express").Router(); const router = require("express").Router();
const jwt = require("jsonwebtoken"); const jwt = require("jsonwebtoken");
const { tokenChecker } = require("../utils/tokenChecker"); const { tokenChecker } = require("../utils/tokenChecker");
......
const fetch = require("isomorphic-unfetch");
const router = require("express").Router(); const router = require("express").Router();
const jwt = require("jsonwebtoken"); const jwt = require("jsonwebtoken");
const { tokenChecker } = require("../utils/tokenChecker"); const { tokenChecker } = require("../utils/tokenChecker");
...@@ -32,7 +31,6 @@ async function updatePin(borrowerNumber, newPin, deichmannCallId) { ...@@ -32,7 +31,6 @@ async function updatePin(borrowerNumber, newPin, deichmannCallId) {
}); });
} }
// ---- Routes // ---- Routes
// Change pin // Change pin
...@@ -67,7 +65,6 @@ router.put("/", tokenChecker, async (request, response) => { ...@@ -67,7 +65,6 @@ router.put("/", tokenChecker, async (request, response) => {
}); });
response.sendStatus(500); response.sendStatus(500);
} }
}); });
module.exports = router; module.exports = router;
/* eslint-disable camelcase */ /* eslint-disable camelcase */
const userSettingsMapper = require("../utils/userSettingsMapper"); const userSettingsMapper = require("../utils/userSettingsMapper");
const fetch = require("isomorphic-unfetch");
const router = require("express").Router(); const router = require("express").Router();
const cookieParser = require("../utils/cookieParser"); const cookieParser = require("../utils/cookieParser");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment