代码:消息列表全部已读功能

  const confirmReadAll = () => {
    for (let i = 0; i <= list.length - 1; i++) {
      confirmReadOnes(list[i].alert_id);
    }
  }

  const confirmReadOnes = (alert_id) => {
    console.log('alert_id ===> ', alert_id);
    axios.put(
      '/alerts',
      {
        is_confirmed: true,
        alert_id,
      },
      {
        headers: { 'Authorization': user.token },
      }
    ).then(
      response => {
        console.log('response.ret:', response.data.ret, 'msg:', response.data.msg);
        updateAlert();
        updateData();
      },
      error => { console.log(error); }
    )
  }

 

posted @ 2022-02-14 16:59  算法阿杰  阅读(214)  评论(0)    收藏  举报