From 2f7270cfef16ca8b494357b6349adff0d8c0fcd2 Mon Sep 17 00:00:00 2001 From: vapao Date: Fri, 28 Feb 2020 00:55:35 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=9C=AA=E8=AF=BB=E6=95=B0=E9=87=8F=E9=94=99=E8=AF=AF=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_web/src/layout/Header.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spug_web/src/layout/Header.js b/spug_web/src/layout/Header.js index 7869348..9688cf1 100644 --- a/spug_web/src/layout/Header.js +++ b/spug_web/src/layout/Header.js @@ -46,9 +46,11 @@ export default class extends React.Component { handleRead = (e, item) => { e.stopPropagation(); - this.state.read.push(item.id); - this.setState({read: this.state.read}); - http.patch('/api/notify/', {ids: [item.id]}) + if (this.state.read.indexOf(item.id) === -1) { + this.state.read.push(item.id); + this.setState({read: this.state.read}); + http.patch('/api/notify/', {ids: [item.id]}) + } }; handleReadAll = () => {