react-table getTrProps onclick事件

时间:2018-02-18 16:03:42

标签: react-table

请帮助我将用户ID从onclick事件传递到新的终点。 以下是我的代码。 Console.log给了我正确的输出,但两者兼而有之。标签在下面的场景中似乎不起作用。

const update = (cb) => {
    _request(urls, responses => {
        let bulkUpdateOps = [], gameid;

        responses.forEach(url => {
            let response = responses[url];
            gameid = url.split('/')[5].split('?')[0];

            if (response.err) {
                logger.error(`Error in request to ${url}: ${response.err}`);
                return;
            }

            if (response.body) {
                logger.info(`Request to ${url} successful.`)
                let jsonResult = {};
                try {
                    jsonResult = JSON.parse(response.body);
                } catch (e) {
                    logger.error(`Could not parse.`);
                }

                Object.keys(jsonResult).forEach(key => {
                    bulkUpdateOps.push({
                        "updateOne": {
                           "filter": { market_hash_name: key },
                           "update": { "$set": {
                                game_id: gameid,
                                price: jsonResult[key]
                           } },
                           "upsert": true
                        }
                    });
                });
            }

            if (bulkUpdateOps.length === 1000) {
                Price.bulkWrite(bulkUpdateOps).then(result => {
                    logger.info(`Updated Items`)
                }).catch(e => logger.error(`Error bulking: ${e}`));
                bulkUpdateOps = [];
            }
        });

        if (bulkUpdateOps.length > 0) {
            Price.bulkWrite(bulkUpdateOps).then(result => {
                logger.info(`Updated Items`)
            }).catch(e => logger.error(`Error bulking: ${e}`));
        }
    });

    if (cb && typeof cb == 'function') {
        cb();
    }
}

0 个答案:

没有答案