import { Data } from "../tw/data/Data";
import { showToast } from "./ctrls/toastCtrl";
import { NetName } from "../tw/enum/NetName";

export default (data: Data, netname: NetName) => {
    if (data.code == 'E999999999')//系统级别错误  系统异常，\n请刷新后重试。
        showToast('网络异常，请稍后重试')
    else if (data.code == 'E100201001')
        showToast('请登录后重试。')
    else if (data.code == 'E100201007') {
        showToast(`对不起\n您的${CFG.unitName}不足`);
    }
    else if (data.code == 'E100202007' || data.code == 'E100202008' || data.code == 'E100202009' || data.code == 'E100202010')
        showToast('对不起\n您的次数不足。')
    else//其他异常
        showToast('网络异常，请稍后重试')
}
// export default (data: Data) => {
//     if (data.code == 'E999999999')
//         showAlertPanel(AlertType.NO_TYPE);
//     else if (data.code == 'E100201001')
//         showAlertPanel(AlertType.NOT_LOGIN);
//     else if (data.code == 'E100202007' || data.code == 'E100202008' || data.code == 'E100202009' || data.code == 'E100202010')
//         showAlertPanel(AlertType.NO_TIMES);
//     else
//         showAlertPanel(AlertType.NO_TYPE)
// }