How to use the @ams-team/ams.request function in @ams-team/ams

To help you get started, we’ve selected a few @ams-team/ams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vipshop / ams / examples / router / src / ams-config / router.js View on Github external
async getUsers() {
            const res = await ams.request({
                url: `${prefix}getUser`,
                method: 'GET'
            });
            if (
                res.data &&
          res.data.code === 0
            ) {
                this.data.userImg = res.data.data.userImg;
                this.data.userName = res.data.data.userName;
            } else {
                this.$message.error(`${res.data.msg}(${res.data.code})`);
            }
        },
        // 退出登录函数
github vipshop / ams / packages / field-tag / src / edit.vue View on Github external
// page: 1,
                    // pageSize: 20
                };
                if (item) {
                    params.params[this.field.props['idKey']] = item;
                    params.params[this.field.props['nameKey']] = item;
                    params.params[this.field.props['subNameKey']] = item;
                }
            }
            const resource = ams.resources[ams.blocks[this.name].resource];
            if (typeof props.withCredentials !== 'undefined') {
                params.withCredentials = props.withCredentials;
            } else if (typeof resource.api.withCredentials !== 'undefined') {
                params.withCredentials = resource.api.withCredentials;
            }
            const res = await ams.request(params);
            const successCode = typeof props.successCode === 'number' ? props.successCode : resource.api.successCode;
            // 默认successCode
            if (
                res.data &&
                res.data.code === successCode &&
                res.data.data &&
                res.data.data.list
            ) {
                return res.data.data.list;
            }
            return [];
        }
    }