Coder Social home page Coder Social logo

umi-request-practice's Introduction

umi-request-practice

虽说仓库名称是 umi-request 的实践,

但也是对部门那套 umi-request 封装的简略复刻版。

虽说,大部分也是我写的。

如果喜欢或有帮助的话,求 Star ⭐⭐⭐

需求

  • 都必须走 POST 方法

  • http 请求头要添加 token 及其他业务要素

  • http 请求体的数据格式需要如下这样:

    已做简化

/** http 请求体 */
interface IHttpBody {
  /** 系统报文头 */
  sysHead: {
    /** 系统标识 */
    system: string;
    /** 服务名称 */
    service: string;
    /** 接口名称 */
    interface: string;
    /** 接口版本 */
    interfaceVersion: string;
  };
  /** 本地报文头 */
  localHead: {
    /** 分页信息 */
    pageInfo: {
      /** 当前页数 */
      current: number;
      /** 每页条数 */
      pageSize: number;
    };
    /** 用户信息 */
    userInfo: {
      /** 用户编号 */
      userNo: string;
      /** 用户名称 */
      userName: string;
      /** 角色编号 */
      roleNo: string;
      /** 角色名称 */
      roleName: string;
    };
    /** 设备信息 */
    deviceInfo: IDeviceInfo;
  };
  /** 报文体 */
  body: {};
}
  • 要支持本地 mock
  • 要支持过滤重复并发请求
  • token 过期要自动跳回登录页面
  • 提供类型支持
  • 提供使用文档
  • 错误均以 notification 通知提醒框的方式进行提醒,且位置位于右上角
  • 希望使用者不再需要对响应结果做非空等判断,直接可使用
  • 即使响应结果是错误,但希望使用者也能接收到,据此做其他逻辑

umi-request-practice's People

Contributors

blueju avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

umi-request-practice's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.