这版是公共号授权版
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { BASE_URL, appId } from "../env";
|
||||
import { BASE_URL } from "../env";
|
||||
import { base64Encode } from "./crypto";
|
||||
type RequestProps = {
|
||||
options: WechatMiniprogram.RequestOption;
|
||||
@@ -23,6 +23,7 @@ export const request = <T = any>(
|
||||
return Promise.reject(new Error('请先登录'));
|
||||
}
|
||||
const openId = wx.getStorageSync("openId") || "";
|
||||
const appId = wx.getStorageSync("appId") || "";
|
||||
header.Authorization = `Basic ${base64Encode(`${openId}:${appId}`)}`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user