Blame view

apps/passport/models/index-service.js 491 Bytes
htoooth authored
1 2 3
/**
 * Created by TaoHuang on 2016/6/21.
 */
htoooth authored
4
'use strict';
htoooth authored
5 6 7

const api = require('./index-api');
htoooth authored
8 9 10 11
/**
 * 获得资源
 */
const getResourceAsync = (resourceCode) => {
htoooth authored
12 13 14 15 16 17 18
    return api.getResourceAsync(resourceCode)
        .then(result => {
            if (result.code === 200) {
                return result.data;
            } else {
                return {};
            }
htoooth authored
19 20
        })
        .catch(() => {
htoooth authored
21 22 23
            return {};
        });
};
htoooth authored
24 25 26 27

module.exports = {
    getResourceAsync
};