2016-08-18 11:41:13 +02:00
|
|
|
/**
|
|
|
|
* app.js
|
|
|
|
*
|
2016-10-05 15:15:43 +02:00
|
|
|
* This is the entry file for the application,
|
|
|
|
* only setup and plugin code.
|
2016-08-18 11:41:13 +02:00
|
|
|
*/
|
|
|
|
|
2016-09-06 17:44:06 +02:00
|
|
|
import { browserHistory } from 'react-router';
|
2016-09-02 17:52:34 +02:00
|
|
|
import configureStore from './store';
|
2016-08-18 11:47:26 +02:00
|
|
|
|
2016-09-02 17:52:34 +02:00
|
|
|
// Create redux store with history
|
|
|
|
// this uses the singleton browserHistory provided by react-router
|
|
|
|
// Optionally, this could be changed to leverage a created history
|
|
|
|
// e.g. `const browserHistory = useRouterHistory(createBrowserHistory)();`
|
|
|
|
const initialState = {};
|
|
|
|
const store = configureStore(initialState, browserHistory);
|
|
|
|
|
|
|
|
// Set up the router, wrapping all Routes in the App component
|
|
|
|
import App from 'containers/App';
|
|
|
|
import createRoutes from './routes';
|
|
|
|
|
2016-10-05 15:15:43 +02:00
|
|
|
// Plugin identifier based on the package.json `name` value
|
|
|
|
const pluginId = require('../package.json').name.replace(/^strapi-/i, '');
|
|
|
|
|
2016-09-02 17:52:34 +02:00
|
|
|
// Register the plugin
|
2016-10-04 17:49:40 +02:00
|
|
|
if (window.Strapi) {
|
|
|
|
window.Strapi.registerPlugin({
|
|
|
|
name: 'Settings Manager',
|
2016-10-05 15:15:43 +02:00
|
|
|
id: pluginId,
|
2016-10-04 17:49:40 +02:00
|
|
|
leftMenuLink: {
|
|
|
|
label: 'Settings Manager',
|
|
|
|
to: '/settings-manager',
|
|
|
|
},
|
|
|
|
mainComponent: App,
|
2016-10-05 13:48:49 +02:00
|
|
|
routes: createRoutes(store),
|
2016-10-04 17:49:40 +02:00
|
|
|
});
|
|
|
|
}
|
2016-10-05 13:48:49 +02:00
|
|
|
|
2016-10-05 15:15:43 +02:00
|
|
|
// API
|
|
|
|
const apiUrl = `${window.Strapi.apiUrl}/${pluginId}`;
|
|
|
|
|
2016-10-05 13:48:49 +02:00
|
|
|
// Export store
|
|
|
|
export {
|
|
|
|
store,
|
2016-10-05 15:15:43 +02:00
|
|
|
apiUrl,
|
|
|
|
};
|