frontend for read status of mails
This commit is contained in:
parent
19e12e25e9
commit
79c356c134
2 changed files with 7 additions and 6 deletions
|
|
@ -11,9 +11,8 @@ export default function MailUnit({
|
|||
createdAt,
|
||||
subject,
|
||||
text,
|
||||
read
|
||||
read,
|
||||
}) {
|
||||
|
||||
return (
|
||||
<Accordion>
|
||||
<AccordionSummary
|
||||
|
|
@ -29,6 +28,8 @@ export default function MailUnit({
|
|||
<Typography>
|
||||
<b>{subject}</b>
|
||||
</Typography>
|
||||
<span style={{ width: '2vw' }} />
|
||||
<Typography>Read: {String(read)}</Typography>
|
||||
</Box>
|
||||
</AccordionSummary>
|
||||
<AccordionDetails>
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@ async function Get(req, res) {
|
|||
|
||||
// Fetch mail if expired
|
||||
if (Number(lastMailFetch) + config.mailExpires < Date.now()) {
|
||||
const messages = await getAllMail({ username });
|
||||
return res.send({ messages });
|
||||
} else {
|
||||
|
||||
await getAllMail({ username })
|
||||
}
|
||||
const messages = await Mail.find({ receiver: username }).sort({
|
||||
createdAt: 'desc',
|
||||
});
|
||||
|
||||
return res.send({ messages });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Get;
|
||||
|
|
|
|||
Reference in a new issue