aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/App.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/App.js')
-rw-r--r--vnext/src/App.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js
index bad57fc4..ea63ae18 100644
--- a/vnext/src/App.js
+++ b/vnext/src/App.js
@@ -10,7 +10,7 @@ import Contacts from './ui/Contacts';
import Chat from './ui/Chat';
import Post from './ui/Post';
import Thread from './ui/Thread';
-import LoginButton from './ui/LoginButton';
+import Login from './ui/Login';
import { UserLink } from './ui/UserInfo';
import SearchBox from './ui/SearchBox';
@@ -22,7 +22,8 @@ export default function App() {
let params = qs.parse(window.location.search.substring(1));
if (params.hash) {
cookie.save('hash', params.hash, { path: '/' });
- window.history.replaceState({}, document.title, `${window.location.protocol}//${window.location.host}${window.location.pathname}`);
+ let retpath = params.retpath || `${window.location.protocol}//${window.location.host}${window.location.pathname}`;
+ window.history.replaceState({}, document.title, retpath);
}
const [visitor, setVisitor] = useState({
uid: 0
@@ -121,7 +122,10 @@ export default function App() {
<span className="desktop">Post</span>
</Link>
:
- <LoginButton title="Login" onAuth={auth} />
+ <Link to={{ pathname: '/login', state: { retpath: window.location.pathname } }}>
+ <Icon name="ei-user" size="s" />
+ <span className="desktop">Login</span>
+ </Link>
}
</nav>
</div>
@@ -136,6 +140,7 @@ export default function App() {
<Route exact path="/settings" render={(props) =>
<Settings visitor={visitor} {...props} onChange={auth} />
} />
+ <Route exact path="/login" render={(props) => <Login visitor={visitor} {...props} onAuth={auth} />} />
<Route exact path="/post" render={(props) => <Post visitor={visitor} {...props} />} />
<Route exact path="/pm" render={(props) => <Contacts visitor={visitor} {...props} />} />
<Route exact path="/pm/:user" render={(props) => <Chat connection={eventSource} visitor={visitor} {...props} />} />