From 9e01a8d3c3daf3257f29ad63b3836dfa89c6200b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 9 Feb 2024 19:10:01 +0300 Subject: vnext: authorize on backend --- vnext/src/ui/Feeds.js | 2 +- vnext/src/ui/Login.js | 88 ------------------------------------------------- vnext/src/ui/Message.js | 4 +-- 3 files changed, 3 insertions(+), 91 deletions(-) delete mode 100644 vnext/src/ui/Login.js (limited to 'vnext/src/ui') diff --git a/vnext/src/ui/Feeds.js b/vnext/src/ui/Feeds.js index 16b6b534..0cebdce6 100644 --- a/vnext/src/ui/Feeds.js +++ b/vnext/src/ui/Feeds.js @@ -35,7 +35,7 @@ function RequireAuth({ children }) { // trying to go to when they were redirected. This allows us to send them // along to that page after they login, which is a nicer user experience // than dropping them off on the home page. - return + return } return children diff --git a/vnext/src/ui/Login.js b/vnext/src/ui/Login.js deleted file mode 100644 index ed0e990c..00000000 --- a/vnext/src/ui/Login.js +++ /dev/null @@ -1,88 +0,0 @@ -import { useEffect } from 'react' -import { useLocation, useNavigate } from 'react-router-dom' - -import Icon from './Icon' -import Button from './Button' -import { useForm } from 'react-hook-form' - -import { me, facebookLink, vkLink, appleLink } from '../api' - -import { useVisitor } from './VisitorContext' - -/** - * @typedef {object} LoginProps - * @property {Function} onAuth - */ - -/** - * Login page - * @param {LoginProps} props - */ -function Login({ onAuth }) { - const location = useLocation() - const navigate = useNavigate() - const [visitor] = useVisitor() - useEffect(() => { - if (visitor && visitor.hash) { - const retpath = location.state?.retpath || '/' - console.log(retpath) - navigate(retpath) - } - }, [navigate, location.state, visitor]) - - const { register, handleSubmit } = useForm() - - /** @type { import('react-hook-form').SubmitHandler } */ - let onSubmit = (values) => { - me(values.username, values.password) - .then(response => { - onAuth(response) - } - ).catch(ex => { - console.log(ex) - }) - } - return ( - - - Please, introduce yourself: - - - Log in - - - - Log in - - - - Already registered? - - - - OK - - - - ) -} - -export default Login - -const socialButtonsStyle = { - display: 'flex', - justifyContent: 'space-evenly', - padding: '4px' -} - -const facebookButtonStyle = { - color: '#fff', - padding: '2px 14px', - background: '#3b5998' -} - -const vkButtonStyle = { - color: '#fff', - padding: '2px 14px', - background: '#4c75a3' -} diff --git a/vnext/src/ui/Message.js b/vnext/src/ui/Message.js index eba0f327..eaac8eba 100644 --- a/vnext/src/ui/Message.js +++ b/vnext/src/ui/Message.js @@ -112,10 +112,10 @@ export default function Message({ data, isThread, onToggleSubscription, children {likesSummary} ) : ( - + {likesSummary} - + )} { data.user && canComment && (( -- cgit v1.2.3
Please, introduce yourself:
Already registered?