I want to collect data from my collections and display it in my own plugin, for example 'Cars'. I have not found anything about this and do not know how to approach this.
import React, { memo } from 'react';
import pluginId from '../../pluginId';
const HomePage = () => {
const fetchData = () => {
// Here I want to fetch data from my collection and display it
return null;
}
return (
<div>
<h1>{pluginId}'s HomePage</h1>
<p>Happy coding</p>
{fetchData()}
</div>
);
};
export default memo(HomePage);
Old question but I've been looking for the answer and it's difficult to find. So the solution for this, is to use the endpoints provided by the content-manager plugin of strapi.
First you should go and allow public access to this endpoints in Settings then Roles & Permissions plugin.
Finally you can query your data like this
const response = await request("/content-manager/collection-types/application::cars.cars", {
method: "GET"
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With