index.js (728B)
1 /** 2 * React Starter Kit (https://www.reactstarterkit.com/) 3 * 4 * Copyright © 2014-present Kriasoft, LLC. All rights reserved. 5 * 6 * This source code is licensed under the MIT license found in the 7 * LICENSE.txt file in the root directory of this source tree. 8 */ 9 10 import React from 'react'; 11 import Layout from '../../components/Layout'; 12 13 const title = 'Admin Page'; 14 const isAdmin = false; 15 16 export default { 17 18 path: '/admin', 19 20 async action() { 21 if (!isAdmin) { 22 return { redirect: '/login' }; 23 } 24 25 const Admin = await require.ensure([], require => require('./Admin').default, 'admin'); 26 27 return { 28 title, 29 chunk: 'admin', 30 component: <Layout><Admin title={title} /></Layout>, 31 }; 32 }, 33 34 };