Socket
Book a DemoInstallSign in
Socket

tplus-api

Package Overview
Dependencies
Maintainers
1
Versions
452
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tplus-api

tplus api invoke

latest
npmnpm
Version
4.0.23
Version published
Weekly downloads
540
5300%
Maintainers
1
Weekly downloads
 
Created
Source

tplusApi -> T+前端网关库

模块说明

  • 云账号登录/注销
  • 注销拦截器
  • 阿里云webtrace日志上报

编写说明

  • 使用typescript

依赖模块

  • mutants-microfx
  • mutants-jsbridge
  • mutants-log

登录 + 注销 + 拦截器 + 请求 + 阿里云日志(代码示例)

const login = async ()=>{
      registerLogoutMiddleWare('loginOut',()=>{
        console.log('注销后...');
      });
      //用户认证 获取企业列表
      const user:User = await User.authentication('${username}','${password}');
      //过滤企业
      let tcOrgs:Array<any> = _filter(user.orgList,org=>org.orgFullName === '${orgName}');
      if(tcOrgs.length > 0){
       const tcOrgId:string = tcOrgs[0].orgId;
       //初始化通道
       await user.initChannel(tcOrgId);
       //登录T+
       await user.loginTplus({});
       console.log('user.logined======',user);
       const response = await tApi({},'${methodName}',false,false);
       console.log('response======',response);
       //用户注销
       User.logout();
       try{
        const response1 = await tApi({},'${methodName}',false,false);
        console.log('logout.response======',response1);
       }catch(e){
        //将API错误日志进行上报
        serverLog('${logstore}',{eventId:'api_error',...e});
       }
      }
};

Keywords

tplus

FAQs

Package last updated on 15 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts