diff options
author | 2021-09-30 22:48:13 +0200 | |
---|---|---|
committer | 2021-10-01 00:53:11 +0200 | |
commit | 79bdb88a5fc099b5871a83d18eadf9b0448b41d1 (patch) | |
tree | d0a8e48dda7649205e08d17c2fa0de938e27a674 /apps/Notes/components/List.js | |
parent | cf1fbb69d7cdb67219be187fc38feea5a6325f45 (diff) | |
download | my_apps-79bdb88a5fc099b5871a83d18eadf9b0448b41d1.tar.gz my_apps-79bdb88a5fc099b5871a83d18eadf9b0448b41d1.tar.bz2 my_apps-79bdb88a5fc099b5871a83d18eadf9b0448b41d1.zip |
added favicons & notes route for phone
Diffstat (limited to 'apps/Notes/components/List.js')
-rw-r--r-- | apps/Notes/components/List.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/Notes/components/List.js b/apps/Notes/components/List.js index 0e6c8fa..7d88c8d 100644 --- a/apps/Notes/components/List.js +++ b/apps/Notes/components/List.js @@ -1,4 +1,5 @@ import styles from '../styles/Notes.module.scss' +import { useRouter } from 'next/router' import React, { useState, useEffect } from 'react' import useUser from 'hooks/useUser' import useSettings from 'hooks/useSettings' @@ -7,8 +8,9 @@ import useSort from '../hooks/useSort' import ListItem from './ListItem' import Actions from './Actions' import { Splash } from 'components' +import handleLogout from 'helpers/logout' -const List = () => { +const List = ({ logout }) => { const [fetchedNote, setFetchedNote] = useState() const [action, setAction] = useState('') const [loading, setLoading] = useState(false) @@ -16,7 +18,8 @@ const List = () => { const { notes, error } = useNotes() const [sortedBy, sortBy, sortFn] = useSort(3) const { t } = useSettings() - const { user } = useUser({ + const router = useRouter() + const { user, mutateUser } = useUser({ redirectToLogin: true, redirectToVerify: true }) @@ -41,6 +44,11 @@ const List = () => { <div className='mobile-only' onClick={() => { setShowSort(s => !s) }}>{t('sort')}</div> <div onClick={() => setAction('importNotes')}>{t('import')}</div> <div onClick={() => setAction('exportNotes')}>{t('export')}</div> + {logout && ( + <div onClick={e => handleLogout(e, router, mutateUser)}> + {t('logout')} + </div> + )} </div> </div> <div className='window__scroll'> |