Commit 09ae4bcf authored by qinhaitao's avatar qinhaitao

fix: 🐛 bug

parent f3173bd8
......@@ -140,7 +140,7 @@ var checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, void
return [4 /*yield*/, helpers_1.promisifyApiToTb('checkShopFavoredStatus', { id: +sellerId })];
case 1:
result = _a.sent();
if (result === null || result === void 0 ? void 0 : result.isFavor)
if ((result === null || result === void 0 ? void 0 : result.isFavor) !== undefined)
return [2 /*return*/, result.isFavor];
if (result === 'checkShopFavoredStatus 仅支持真机调用,请在手机淘宝中运行')
return [2 /*return*/, true];
......
This diff is collapsed.
......@@ -220,10 +220,15 @@ exports.uploadImage = uploadImage;
*/
var getAuthUserInfo = function () {
return new Promise(function (resolve, reject) {
// @ts-ignore
my.getAuthUserInfo({
success: function (userInfo) {
resolve(userInfo);
},
fail: function (err) {
my.authorize({
scopes: 'scope.userInfo',
success: function () {
console.log('执行 my.authorize');
// @ts-ignore
my.getAuthUserInfo({
success: function (userInfo) {
......@@ -238,6 +243,9 @@ var getAuthUserInfo = function () {
reject(err);
}
});
}
});
// @ts-ignore
});
};
exports.getAuthUserInfo = getAuthUserInfo;
......
This diff is collapsed.
{
"name": "tbcc-sdk-ts",
"version": "1.0.2",
"version": "1.0.4",
"description": "",
"main": "lib/index.js",
"scripts": {
......
......@@ -75,7 +75,7 @@ export const checkShopFavoredStatus = async (sellerId: number) => {
return false;
}
let result: { isFavor?: boolean } = await promisifyApiToTb('checkShopFavoredStatus',{ id: +sellerId })
if(result?.isFavor) return result.isFavor
if(result?.isFavor !== undefined) return result.isFavor
if(result === 'checkShopFavoredStatus 仅支持真机调用,请在手机淘宝中运行')return true
return result
};
......
......@@ -149,10 +149,15 @@ export const uploadImage = async (opts = {}) => {
*/
export const getAuthUserInfo = () => {
return new Promise((resolve, reject) => {
// @ts-ignore
my.getAuthUserInfo({
success: userInfo => {
resolve(userInfo);
},
fail: err => {
my.authorize({
scopes: 'scope.userInfo',
success: () => {
console.log('执行 my.authorize')
// @ts-ignore
my.getAuthUserInfo({
success: userInfo => {
......@@ -167,6 +172,10 @@ export const getAuthUserInfo = () => {
reject(err);
}
});
}
});
// @ts-ignore
});
};
/**
......
......@@ -76,3 +76,5 @@ interface ISkuInfo {
skuId: string
quantity: string
}
declare var my: any
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment