Skip to content

Commit

Permalink
Add storybook proxy to connect directly to real API
Browse files Browse the repository at this point in the history
  • Loading branch information
jardakotesovec committed Jun 27, 2024
1 parent 9fda085 commit 8276669
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 5 deletions.
11 changes: 11 additions & 0 deletions .storybook/middleware.js
Original file line number Diff line number Diff line change
@@ -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,
}),
);
};
85 changes: 85 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 7 additions & 4 deletions public/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
},
/**
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/userInvitation/UserInvitationSearchFormStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand Down

0 comments on commit 8276669

Please sign in to comment.