提交 8d410008 编写于 作者: D DCloud_LXH

chore(app): getAppAuthorizeSetting

上级 aaaf1cf1
......@@ -4,18 +4,27 @@ import {
defineSyncApi,
} from '@dcloudio/uni-api'
type AppAuthorizeSetting = ReturnType<API_TYPE_GET_APP_AUTHORIZE_SETTING>
export const getAppAuthorizeSetting =
defineSyncApi<API_TYPE_GET_APP_AUTHORIZE_SETTING>(
API_GET_APP_AUTHORIZE_SETTING,
() => {
const { getAppAuthorizeSetting } = weex.requireModule('plus')
let appAuthorizeSetting =
getAppAuthorizeSetting() as ReturnType<API_TYPE_GET_APP_AUTHORIZE_SETTING>
let appAuthorizeSetting = getAppAuthorizeSetting() as AppAuthorizeSetting
try {
if (typeof appAuthorizeSetting === 'string')
appAuthorizeSetting = JSON.parse(appAuthorizeSetting)
} catch (error) {}
for (const key in appAuthorizeSetting) {
if (Object.hasOwnProperty.call(appAuthorizeSetting, key)) {
const value = appAuthorizeSetting[key as keyof AppAuthorizeSetting]
// @ts-ignore
if (value === 'undefined') appAuthorizeSetting[key] = undefined
}
}
return appAuthorizeSetting
}
)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册