aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/App.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-07-10 18:58:52 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:55 +0300
commitc766a3aabba6fda6d9e7e13e39f8780226989fe6 (patch)
tree2233407d79bea2609a321c40b1843dae261eff2b /vnext/src/App.js
parentcf9050f7d6fb61e0743bc9bc3ba2c26b2109cd33 (diff)
login wip
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} />} />