strapi-ts
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite
26 lines (21 loc) • 554 B
JavaScript
;
// Dependencies.
const { isEmpty } = require('lodash');
const openBrowser = require('./openBrowser');
module.exports = {
/*
* Return false where there is no administrator, otherwise return true.
*/
async isInitialised(strapi) {
try {
if (isEmpty(strapi.admin)) {
return true;
}
const numberOfAdministrators = await strapi.query('user', 'admin').find({ _limit: 1 });
return numberOfAdministrators.length > 0;
} catch (err) {
strapi.stopWithError(err);
}
},
openBrowser,
};