diff --git a/.storybook/middleware.js b/.storybook/middleware.js new file mode 100644 index 000000000..6bf40ab3c --- /dev/null +++ b/.storybook/middleware.js @@ -0,0 +1,11 @@ +const {createProxyMiddleware} = require('http-proxy-middleware'); + +module.exports = function expressMiddleware(router) { + router.use( + '/index.php', // This is the API prefix that you want to proxy + createProxyMiddleware({ + target: 'http://localhost:7003', // The backend server you want to proxy to + changeOrigin: true, + }), + ); +}; diff --git a/package-lock.json b/package-lock.json index b526d582a..d1e7f485c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,6 +54,7 @@ "eslint": "^8.48.0", "eslint-plugin-storybook": "^0.8.0", "eslint-plugin-vue": "^9.17.0", + "http-proxy-middleware": "^3.0.0", "husky": "^8.0.3", "less": "^4.2.0", "lint-staged": "^14.0.1", @@ -4995,6 +4996,15 @@ "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" }, + "node_modules/@types/http-proxy": { + "version": "1.17.14", + "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.14.tgz", + "integrity": "sha512-SSrD0c1OQzlFX7pGu1eXxSEjemej64aaNPRhhVYUGqXh0BtldAAx37MG8btcumvpgKyZp1F5Gn3JkktdxiFv6w==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/is-function": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@types/is-function/-/is-function-1.0.3.tgz", @@ -8761,6 +8771,26 @@ "node": ">=0.4.0" } }, + "node_modules/follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -9342,6 +9372,55 @@ "node": ">= 0.8" } }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-proxy-middleware": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-3.0.0.tgz", + "integrity": "sha512-36AV1fIaI2cWRzHo+rbcxhe3M3jUDCNzc4D5zRl57sEWRAxdXYtw7FSQKYY6PDKssiAKjLYypbssHk+xs/kMXw==", + "dev": true, + "dependencies": { + "@types/http-proxy": "^1.17.10", + "debug": "^4.3.4", + "http-proxy": "^1.18.1", + "is-glob": "^4.0.1", + "is-plain-obj": "^3.0.0", + "micromatch": "^4.0.5" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/http-proxy-middleware/node_modules/is-plain-obj": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", + "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/http-proxy/node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -13765,6 +13844,12 @@ "node": ">=0.10.5" } }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", diff --git a/package.json b/package.json index 8cf7ad2fd..382413a13 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "eslint": "^8.48.0", "eslint-plugin-storybook": "^0.8.0", "eslint-plugin-vue": "^9.17.0", + "http-proxy-middleware": "^3.0.0", "husky": "^8.0.3", "less": "^4.2.0", "lint-staged": "^14.0.1", diff --git a/public/globals.js b/public/globals.js index 4b31c4587..2143b3f5b 100644 --- a/public/globals.js +++ b/public/globals.js @@ -25,7 +25,7 @@ window.pkp = { * */ context: { - apiBaseUrl: 'https://mock/index.php/publicknowledge/api/v1/', + apiBaseUrl: '/index.php/publicknowledge/api/v1/', pageBaseUrl: 'https://mock/index.php/publicknowledge/', }, /** @@ -436,10 +436,13 @@ window.pkp = { 'orcid.field.verification.request': 'Request verification', 'orcid.field.verification.requested': 'Verification requested!', 'orcid.field.authorEmailModal.title': 'Request ORCID verification', - 'orcid.field.authorEmailModal.message': 'Would you like to send an email to this author requesting they verify their ORCID?', + 'orcid.field.authorEmailModal.message': + 'Would you like to send an email to this author requesting they verify their ORCID?', 'orcid.field.deleteOrcidModal.title': 'Delete ORCID', - 'orcid.field.deleteOrcidModal.message': 'Are you sure you want to remove this ORCID?', - 'orcid.field.unverified.shouldRequest': 'This ORCID has not been verified. Please remove this unverified ORCID and request verification from the user/author directly.', + 'orcid.field.deleteOrcidModal.message': + 'Are you sure you want to remove this ORCID?', + 'orcid.field.unverified.shouldRequest': + 'This ORCID has not been verified. Please remove this unverified ORCID and request verification from the user/author directly.', 'publication.jats.autoCreatedMessage': 'This JATS file is generated automatically by the submission metadata', 'publication.jats.confirmDeleteFileButton': 'Delete JATS File', diff --git a/src/pages/userInvitation/UserInvitationSearchFormStep.vue b/src/pages/userInvitation/UserInvitationSearchFormStep.vue index 276c24e7d..a4e1bf995 100644 --- a/src/pages/userInvitation/UserInvitationSearchFormStep.vue +++ b/src/pages/userInvitation/UserInvitationSearchFormStep.vue @@ -70,7 +70,7 @@ const searchPhrase = computed(() => { async function searchUser() { if (searchPhrase.value !== '') { - const {apiUrl} = useUrl('_user'); + const {apiUrl} = useUrl('users'); const {data: userData, fetch} = useFetch(apiUrl, { query: {searchPhrase: searchPhrase.value, status: 'all'},