mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +00:00
Integrate in Strapi project
This commit is contained in:
parent
18f5c15773
commit
a1c344ab15
14
config/routes.json
Normal file
14
config/routes.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"routes": {
|
||||
"GET /admin": {
|
||||
"controller": "Admin",
|
||||
"action": "index",
|
||||
"policies": []
|
||||
},
|
||||
"GET /admin/:file": {
|
||||
"controller": "Admin",
|
||||
"action": "file",
|
||||
"policies": []
|
||||
}
|
||||
}
|
||||
}
|
||||
33
controllers/Admin.js
Normal file
33
controllers/Admin.js
Normal file
@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
const sendfile = require('koa-sendfile');
|
||||
const path = require('path');
|
||||
|
||||
/**
|
||||
* A set of functions called "actions" for `Admin`
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
||||
index: function *() {
|
||||
console.log('index');
|
||||
|
||||
// Send the admin build
|
||||
yield sendfile(this, path.resolve(__dirname, '..', 'public', 'build', 'index.html'));
|
||||
if (!this.status) this.throw(404);
|
||||
},
|
||||
|
||||
file: function *() {
|
||||
console.log('file');
|
||||
// TODO: manage assets
|
||||
console.log(this.params) ;
|
||||
|
||||
|
||||
// Send the admin build
|
||||
// TODO: manage assets
|
||||
yield sendfile(this, path.resolve(__dirname, '..', 'public', 'build', this.params.file));
|
||||
if (!this.status) this.throw(404);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
43
public/app/containers/HomePage/sagas.js
Normal file
43
public/app/containers/HomePage/sagas.js
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
// /**
|
||||
// * Gets the repositories of the user from Github
|
||||
// */
|
||||
//
|
||||
// import { take, call, put, select, fork, cancel } from 'redux-saga/effects';
|
||||
// import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
// import { REGISTER_PLUGIN } from 'containers/App/constants';
|
||||
//
|
||||
// import { getAsyncInjectors } from 'utils/asyncInjectors';
|
||||
// // const { injectReducer, injectSagas } = getAsyncInjectors(store); // eslint-disable-line no-unused-vars
|
||||
// import { Router, Route, Link } from 'react-router'
|
||||
//
|
||||
// /**
|
||||
// * Register plugin
|
||||
// */
|
||||
// export function* registerPlugin() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Watches for REGISTER_PLUGIN action and calls handler
|
||||
// */
|
||||
// export function* getPluginsWatcher() {
|
||||
// yield call(registerPlugin);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Root saga manages watcher lifecycle
|
||||
// */
|
||||
// export function* pluginData() {
|
||||
// // Fork watcher so we can continue execution
|
||||
// const watcher = yield fork(getPluginsWatcher);
|
||||
//
|
||||
// // Suspend execution until location changes
|
||||
// yield take(LOCATION_CHANGE);
|
||||
// yield cancel(watcher);
|
||||
// }
|
||||
//
|
||||
// // Bootstrap sagas
|
||||
// export default [
|
||||
// pluginData,
|
||||
// ];
|
||||
@ -8,7 +8,7 @@
|
||||
<!-- Allow installing the app to the homescreen -->
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<title>React.js Boilerplate</title>
|
||||
<title>Strapi Admin</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- The app hooks into this div -->
|
||||
|
||||
@ -22,6 +22,7 @@ export default function createRoutes(store) {
|
||||
name: 'home',
|
||||
getComponent(nextState, cb) {
|
||||
const importModules = Promise.all([
|
||||
System.import('containers/HomePage/sagas'),
|
||||
System.import('containers/HomePage'),
|
||||
]);
|
||||
|
||||
@ -39,6 +40,7 @@ export default function createRoutes(store) {
|
||||
name: 'plugins',
|
||||
getComponent(nextState, cb) {
|
||||
const importModules = Promise.all([
|
||||
System.import('containers/HomePage/sagas'),
|
||||
System.import('containers/HomePage'),
|
||||
]);
|
||||
|
||||
|
||||
16
services/Admin.js
Normal file
16
services/Admin.js
Normal file
@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
// Public dependencies.
|
||||
const _ = require('lodash');
|
||||
|
||||
/**
|
||||
* A set of functions called "actions" for `Admin`
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user