fix plugin name in service
parent
ae26b28238
commit
189c8f55c6
|
@ -1,28 +1,11 @@
|
|||
// "use strict";
|
||||
|
||||
// module.exports = ({ strapi }) => ({
|
||||
// getContentTypes(ctx) {
|
||||
// const data = strapi
|
||||
// .plugin("content-type-explorer")
|
||||
// .service("explorerService")
|
||||
// .getContentTypes();
|
||||
|
||||
// let neededData = Object.keys(data).map((key) => ({
|
||||
// name: key,
|
||||
// attributes: data[key]["attributes"],
|
||||
// info: data[key]["info"],
|
||||
// // kind: data[key]["kind"],
|
||||
// key: data[key]["uid"],
|
||||
// }));
|
||||
|
||||
// ctx.body = neededData;
|
||||
// },
|
||||
// });
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
module.exports = ({ strapi }) => ({
|
||||
async getTypes(ctx) {
|
||||
ctx.body = "You are in the my-plugin-content-type controller!";
|
||||
const contentTypes = await strapi
|
||||
.service("plugin::strapi-content-type-explorer.explorerService")
|
||||
.getContentTypes();
|
||||
|
||||
ctx.body = contentTypes;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = ({ strapi }) => ({
|
||||
getContentTypes() {
|
||||
return strapi.contentTypes;
|
||||
async getContentTypes() {
|
||||
const types = strapi.contentTypes;
|
||||
|
||||
let formattedTypes = Object.keys(types).map((key) => ({
|
||||
name: key,
|
||||
attributes: types[key]["attributes"],
|
||||
info: types[key]["info"],
|
||||
// kind: data[key]["kind"],
|
||||
key: types[key]["uid"],
|
||||
}));
|
||||
|
||||
return formattedTypes;
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue