Disconnect unactive users

This commit is contained in:
2024-07-02 15:00:02 +02:00
parent 1ca14549fc
commit 4b78471916
3 changed files with 28 additions and 4 deletions
@@ -82,6 +82,7 @@ export default function CreateForm({
}
await handleSubmit({
userId: session.user.userId,
accessToken: session.user.accessToken,
content: formattedContent,
collection,
+5 -3
View File
@@ -12,7 +12,7 @@ import Divider from '@mui/material/Divider'
import Box from '@mui/material/Box'
import {readItems, withToken} from '@directus/sdk'
import LogoutCountdown from '../session/logout-countdown.js'
import {directusClient} from '@/lib/directus.js'
import {directusClient, handleUserStatus} from '@/lib/directus.js'
import {formatDate} from '@/lib/format.js'
const commentsPerPage = process.env.NEXT_PUBLIC_COMMENTS_PER_PAGE || 2
@@ -30,6 +30,8 @@ export default function ListComments({session, selectedTitre, isOpen, setIsOpen,
useEffect(() => {
async function fetchComments() {
try {
await handleUserStatus(session.user.accessToken, session.user.userId)
const result = await directusClient.request(withToken(
session.user.accessToken,
readItems('commentaires', {
@@ -73,7 +75,7 @@ export default function ListComments({session, selectedTitre, isOpen, setIsOpen,
<Dialog open={isOpen} onClose={handleClose}>
<DialogTitle>Commentaires</DialogTitle>
<List sx={{width: '100%', maxWidth: 360, bgcolor: 'background.paper'}}>
{selectedComments && selectedComments.length > 0 ? selectedComments.map(({id, date_created, text, user_created}) => (
{selectedComments && selectedComments.length > 0 ? selectedComments.map(({id, date_created, contenu, user_created}) => (
<React.Fragment key={id}>
<ListItem alignItems='flex-start'>
<ListItemText
@@ -90,7 +92,7 @@ export default function ListComments({session, selectedTitre, isOpen, setIsOpen,
variant='body2'
color='text.primary'
>
{text}
{contenu}
</Typography>
<br />
{formatDate(date_created, 'PPPPpp')}