@lcap/nasl
Version:
NetEase Application Specific Language
42 lines • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.initialize = void 0;
const requestUrl = '/api/v1/app/config';
async function initialize({ app, axios, useCache }) {
if (useCache) {
return;
}
let bol = false;
const { data: res } = await axios.get(requestUrl, {
headers: {
appId: app.id,
},
params: {
key: 'formDesignerEnabled',
},
});
if (!res?.result || !Array.isArray(res.result)) {
return;
}
if (res.result.length === 0) {
app.formDesignerEnabled = bol;
}
else {
bol = res.result[0]?.value === 'true';
app.formDesignerEnabled = bol;
}
// 应用模板导入...
if (!bol && Object.keys(app.composeCache ?? {}).length) {
await axios.post(requestUrl, {
key: 'formDesignerEnabled',
value: true,
}, {
headers: {
appId: app.id,
},
});
app.formDesignerEnabled = true;
}
}
exports.initialize = initialize;
//# sourceMappingURL=form-designer.js.map