2017-10-22 9 views
0

電子メールリンクのランディングページとして機能するカスタムルートをAORに追加しようとしています。 http://localhost:3000/random_pageに移動すると、URLがhttp://localhost:3000/random_page#/に変更され、自分のRandomPageではなくDashboardコンポーネントがレンダリングされます。私はおそらくここでは単純なものが欠けているでしょうが、これはベアボーンのカスタムルートの例です。誰でも私が間違っていることを見ることができますか?ダッシュボードにリダイレクトするカスタムルートの管理

import React from 'react' 
 
import { Route } from 'react-router-dom' 
 
import RandomPage from './RandomPage' 
 

 
export default [ 
 
    <Route exact path="/random_page" component={RandomPage} noLayout/>, 
 
]

import React, { Component } from 'react'; 
 
import './App.css'; 
 
import { jsonServerRestClient, fetchUtils, Admin, Resource, Delete } from 'admin-on-rest'; 
 
import { LogList } from './components/LogList'; 
 
import { UserLogs } from './components/UserLogs'; 
 
import Dashboard from './components/Dashboard' 
 
import authClient from './authClient' 
 
import customRoutes from './customRoutes' 
 

 
const httpClient = (url, options = {}) => { 
 
    if (!options.headers) { 
 
     options.headers = new Headers({ Accept: 'application/json' }); 
 
    } 
 
    options.headers.set('X-AUTH-TOKEN', localStorage.getItem('token')); 
 
    return fetchUtils.fetchJson(url, options); 
 
} 
 

 
class App extends Component { 
 
    render() { 
 
    return (
 
     <Admin 
 
     authClient={authClient} 
 
     title = "Logs" 
 
     restClient={jsonServerRestClient('http://localhost:3001/admin', httpClient)} 
 
     customRoutes={customRoutes} 
 
     dashboard={Dashboard} 
 
     > 
 
     <Resource name="users" list={UserList} show={UserLogs}/> 
 
     <Resource name="logs" list={LogList} remove={Delete} /> 
 
     </Admin> 
 
    ); 
 
    } 
 
} 
 

 
export default App;

答えて

0

私はあなたがドキュメント内<Admin>コンポーネントの下にcatchAllを探していると信じています。必要な情報をURLから解析し、それに応じて処理することができます。

関連する問題