From 8887e1b51565b992f34c955c459125eb85b28483 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 31 Oct 2022 22:48:30 +0300 Subject: `useVisitor` hook --- vnext/src/ui/Settings.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'vnext/src/ui/Settings.js') diff --git a/vnext/src/ui/Settings.js b/vnext/src/ui/Settings.js index ccafffa3..3ae33567 100644 --- a/vnext/src/ui/Settings.js +++ b/vnext/src/ui/Settings.js @@ -6,11 +6,13 @@ import Button from './Button'; import Icon from './Icon'; import UploadButton from './UploadButton'; import Avatar from './Avatar'; +import { useVisitor } from './VisitorContext'; /** - * @param {{ visitor: import('../api').SecureUser, onChange: function }} props + * @param {{ onChange: Function }} props */ -function ChangeAvatarForm({ visitor, onChange }) { +function ChangeAvatarForm({ onChange }) { + const [visitor] = useVisitor(); const [avatar, setAvatar] = useState(''); const [preview, setPreview] = useState(); const avatarInput = useRef(); @@ -53,9 +55,11 @@ function ChangeAvatarForm({ visitor, onChange }) { } /** - * @param {{ visitor: import('../api').SecureUser, onChange: function }} props + * @param {{ onChange: Function }} props */ -export default function Settings({ visitor, onChange }) { +export default function Settings({ onChange }) { + + const [visitor] = useVisitor(); let passwordChanged = (event) => { console.log('password changed'); @@ -100,7 +104,7 @@ export default function Settings({ visitor, onChange }) {