删除部分代码

This commit is contained in:
cao123
2026-09-01 17:51:32 +08:00
parent 4f75a19965
commit ed5f5a7d9a
2 changed files with 3 additions and 14 deletions
+3 -11
View File
@@ -1,5 +1,4 @@
import { BASE_URL, appId } from "../env";
import { base64Encode } from "./crypto";
import { BASE_URL } from "../env";
type RequestProps = {
options: WechatMiniprogram.RequestOption;
loadingTitle?: string;
@@ -21,19 +20,12 @@ const generateFingerprint = (): string => {
export const request = <T = any>(
{ options, loadingTitle = "加载中", isLoading = true, needLogin = true }: RequestProps
{ options, loadingTitle = "加载中", isLoading = true }: RequestProps
): Promise<T> => {
const app = getApp<IAppOption>();
const header: any = {
"X-Fingerprint": generateFingerprint(),
};
if (needLogin) {
if (!app.checkLoginState()) {
return Promise.reject(new Error('请先登录'));
}
const openId = wx.getStorageSync("openId") || "";
header.Authorization = `Basic ${base64Encode(`${openId}:${appId}`)}`
}
return new Promise((resolve, reject) => {