Updating usage of Link fabric component

This commit is contained in:
Neha Gupta 2019-04-04 18:07:08 -07:00
Родитель 224df4ec66
Коммит c98bd6921a
2 изменённых файлов: 8 добавлений и 9 удалений

Просмотреть файл

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Switch, Route } from 'react-router-dom'; import { Switch, Route, Link } from 'react-router-dom';
import { Link } from 'office-ui-fabric-react'; import { Link as FabricLink } from 'office-ui-fabric-react';
import './App.css'; import './App.css';
import { PrivateRoute } from './components/PrivateRoute'; import { PrivateRoute } from './components/PrivateRoute';
@ -31,11 +31,11 @@ getCurrentSample(id)
return ( return (
<div className="maincontent"> <div className="maincontent">
maincontent maincontent
<Link href='/contribute'>Contributions</Link> <FabricLink as={Link} to='/contribute'>Contributions</FabricLink>
</div> </div>
); );
}} }}
/> />
<Route exact path='/login' component={Login} /> <Route exact path='/login' component={Login} />
<PrivateRoute exact path='/contribute' component={Contribute} /> <PrivateRoute exact path='/contribute' component={Contribute} />
</Switch> </Switch>

Просмотреть файл

@ -1,7 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Redirect } from 'react-router-dom'; import { Redirect } from 'react-router-dom';
import { Link as FabricLink } from 'office-ui-fabric-react';
import { Link } from 'office-ui-fabric-react';
class Login extends Component { class Login extends Component {
constructor(props) { constructor(props) {
@ -29,11 +28,11 @@ class Login extends Component {
return ( return (
<div> <div>
<p>You must log in to view the page at {from.pathname}</p> <p>You must log in to view the page at {from.pathname}</p>
<Link href={`/api/user/login?returnUrl=${from.pathname}`}>Sign in using Fabric Link</Link> <FabricLink href={`/api/user/login?returnUrl=${from.pathname}`}>Sign in using Fabric Link</FabricLink>
<br/> <br/>
<Link href={'/api/user/logout'}>Sign out</Link> <FabricLink href={'/api/user/logout'}>Sign out</FabricLink>
<br/> <br/>
<button onClick={this.newLogin}>Sign in</button> <button onClick={this.onLogin}>Sign in</button>
</div> </div>
) )
} }