services.md 848 B

Service 接口请求

通过环境变量 REACT_APP_BACKEND_URL 设置 baseUrl

headers.token 默认通过 getTokenInfo().token 方法获取

基本用法

import { service } from "@dage/pc-components";

export const getList = () => {
  return service.get<IResponse>("/api/list");
};

监听登录失效

import { eventBus } from "@dage/pc-components";

eventBus.on("Event.login.invalid", () => {
  globalThis.location.href = "#/login";
});

Service Attributes

Name Description Type Default
hidden 隐藏错误提醒 boolean false

Events

Name Description Callback
Event.login.invalid 登录失效 DageResponse