Skip to content

Commit

Permalink
Merge pull request #15447 from strapi/market-pagination/fix-axios
Browse files Browse the repository at this point in the history
Fix marketplace data fetching
  • Loading branch information
remidej committed Jan 16, 2023
2 parents 13116b3 + c302f36 commit f4026aa
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 129 deletions.
Expand Up @@ -4,18 +4,15 @@ import qs from 'qs';
const MARKETPLACE_API_URL = 'https://market-api.strapi.io';

const fetchMarketplacePlugins = async (params = {}) => {
const { data: response } = await axios.get(`${MARKETPLACE_API_URL}/plugins`, {
const { data } = await axios.get(`${MARKETPLACE_API_URL}/plugins`, {
params,
paramsSerializer: (params) => qs.stringify(params),
paramsSerializer: {
encode: qs.parse,
serialize: qs.stringify,
},
});

// Only keep v4 plugins
const filteredResponse = {
...response,
data: response.data.filter((plugin) => plugin.attributes.strapiCompatibility === 'v4'),
};

return filteredResponse;
return data;
};

export { fetchMarketplacePlugins };
Expand Up @@ -6,7 +6,10 @@ const MARKETPLACE_API_URL = 'https://market-api.strapi.io';
const fetchMarketplaceProviders = async (params = {}) => {
const { data } = await axios.get(`${MARKETPLACE_API_URL}/providers`, {
params,
paramsSerializer: (params) => qs.stringify(params),
paramsSerializer: {
encode: qs.parse,
serialize: qs.stringify,
},
});

return data;
Expand Down
Expand Up @@ -602,6 +602,25 @@ exports[`Marketplace page - layout renders the online layout 1`] = `
border: none;
}
.c38 {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
width: 100%;
background: transparent;
border: none;
}
.c38:focus {
outline: none;
}
.c38[aria-disabled='true'] {
cursor: not-allowed;
}
.c32 {
border: none;
border-radius: 4px;
Expand Down Expand Up @@ -663,37 +682,6 @@ exports[`Marketplace page - layout renders the online layout 1`] = `
box-shadow: #4945ff 0px 0px 0px 2px;
}
.c58 path {
fill: #666687;
}
.c60 path {
fill: #f29d41;
}
.c75 path {
fill: #328048;
}
.c38 {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
width: 100%;
background: transparent;
border: none;
}
.c38:focus {
outline: none;
}
.c38[aria-disabled='true'] {
cursor: not-allowed;
}
.c37 {
position: relative;
border: 1px solid #dcdce4;
Expand Down Expand Up @@ -780,6 +768,18 @@ exports[`Marketplace page - layout renders the online layout 1`] = `
box-shadow: #4945ff 0px 0px 0px 2px;
}
.c58 path {
fill: #666687;
}
.c60 path {
fill: #f29d41;
}
.c75 path {
fill: #328048;
}
.c81 > * + * {
margin-left: 4px;
}
Expand Down Expand Up @@ -2302,7 +2302,7 @@ exports[`Marketplace page - layout renders the online layout 1`] = `
class="c8 c41"
id="select-13-content"
>
10
24
</span>
</div>
</div>
Expand Down
@@ -1,49 +1,5 @@
const plugins = {
data: [
{
id: 'recQHmaveQknjaIdv',
attributes: {
name: 'Cloudflare pages',
description: 'This plugin lets you easily trigger Cloudflare Pages builds from Strapi.',
slug: 'strapi-plugin-cloudflare-pages',
npmPackageName: 'strapi-plugin-cloudflare-pages',
npmPackageUrl: 'https://www.npmjs.com/package/strapi-plugin-cloudflare-pages',
repositoryUrl: 'https://github.com/sarhugo/strapi-plugin-cloudflare-pages',
logo: {
id: 'attzLRKpax5MIrMtq',
width: 160,
height: 160,
url: 'https://dl.airtable.com/.attachments/3e586bbcdd7dc2effc3770fd49506aa6/ddbb2540/cf-logo-v-rgb.jpg',
filename: 'cf-logo-v-rgb.jpg',
size: 25615,
type: 'image/jpeg',
thumbnails: {
small: {
url: 'https://dl.airtable.com/.attachmentThumbnails/aa98b52525fdeb5767cf554563a9df14/7a03d156',
width: 36,
height: 36,
},
large: {
url: 'https://dl.airtable.com/.attachmentThumbnails/a0e91d3564a0f41d89799e352b06c8ee/3d45329e',
width: 160,
height: 160,
},
full: {
url: 'https://dl.airtable.com/.attachmentThumbnails/20b4afecf2bf8bc081c54eae92a7f599/d1e10f39',
width: 3000,
height: 3000,
},
},
},
developerName: 'Hugo Sarti',
validated: false,
madeByStrapi: false,
strapiCompatibility: 'v3',
strapiVersion: '^4.0.0',
githubStars: 23,
npmDownloads: 5623,
},
},
{
id: 'recWQXzTM5e6Friiq',
attributes: {
Expand Down Expand Up @@ -407,49 +363,6 @@ const plugins = {
npmDownloads: 7492,
},
},
{
id: 'recqR0rWAw5gZHc1c',
attributes: {
name: 'Documentation v3',
description: 'Create an OpenAPI Document and visualize your API with SWAGGER UI',
slug: 'strapi-plugin-documentation',
npmPackageName: 'strapi-plugin-documentation',
npmPackageUrl: 'https://www.npmjs.com/package/strapi-plugin-documentation',
repositoryUrl:
'https://github.com/strapi/strapi/tree/v3.6.9/packages/strapi-plugin-documentation',
logo: {
id: 'att22dETRlzkfVWAl',
width: 225,
height: 225,
url: 'https://dl.airtable.com/.attachments/b6998ac52e8b0460b8a14ced8074b788/2a4d4a90/swagger.png',
filename: 'swagger.png',
size: 6052,
type: 'image/png',
thumbnails: {
small: {
url: 'https://dl.airtable.com/.attachmentThumbnails/71a6b03e03a6b26647991a617478cdfa/8e1d8d2b',
width: 36,
height: 36,
},
large: {
url: 'https://dl.airtable.com/.attachmentThumbnails/c249c4953d5bb0e2f58ed7174afecc2f/796dca09',
width: 225,
height: 225,
},
full: {
url: 'https://dl.airtable.com/.attachmentThumbnails/4b7bc3a765f3927b9fcd12809ddf82a8/d3a4b97b',
width: 3000,
height: 3000,
},
},
},
developerName: 'Strapi team',
validated: true,
madeByStrapi: false,
strapiCompatibility: 'v3',
strapiVersion: '^4.3.0',
},
},
{
id: 'rec5s49X99wA67Ubj',
attributes: {
Expand Down

0 comments on commit f4026aa

Please sign in to comment.