import { getUnReadApproveNumber } from "../service/user";
import request from '../utils/request'
const { OK } = request


export const getDot = async () => {
  const user = wx.getStorageSync('user')
  if (!user || !user.id) {
    return;
  }
  const { code, message, data } = await getUnReadApproveNumber();
  if (code !== OK) {
    return;
  }
  if (data > 0) {
    wx.showTabBarRedDot({
      index: 2,
    })
  } else {
    wx.hideTabBarRedDot({
      index: 2,
    })
  }
  return data;
}