@toolkit-fe/get-location
Version:
获取当前位置
33 lines (32 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleWXSDKCall = void 0;
var handle_get_location_1 = require("./handle-get-location");
/**
* 唤起微信api
* @param {*} _href 当前页面url
* @param {*} options 分享信息
* @param {*} apiType 调用api类型
*/
var handleWXSDKCall = function (_href, apiType) {
return new Promise(function (resolve, reject) {
// 通过后台接口获取配置信息
WeChatServivce.sign(_href)
.then(function (res) {
if (res) {
if (apiType === 'location') {
(0, handle_get_location_1.handleGetLocation)(res).then(function (res) {
resolve(res);
}).catch(function (err) {
reject(err);
});
}
}
})
.catch(function (err) {
reject("err-sign: ".concat(err));
console.error(err.data.code + err.data.msg);
});
});
};
exports.handleWXSDKCall = handleWXSDKCall;