@blessmesanta/strapi-google-maps
Version:
A Google Maps custom field for Strapi, allowing you to pick a location.
32 lines (31 loc) • 879 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const uid = 'plugin::google-maps.config';
const fields = ['googleMapsKey'];
exports.default = ({ strapi }) => ({
async retrieve() {
let config;
/* Find existing config */
config = (await strapi.entityService.findMany(uid, {
fields,
}));
/* Create config if not found */
if (!config) {
config = (await strapi.entityService.create(uid, {
fields,
data: {},
}));
}
return config;
},
async update(data) {
/* Retrieve config */
let config = await this.retrieve();
/* Update config */
config = await strapi.entityService.update(uid, config.id, {
...data,
fields,
});
return config;
},
});