Pull steam id from ensl api

This commit is contained in:
Chris Blanchard 2015-08-31 16:50:56 +01:00
parent c61681997a
commit 8e8eeef844

View file

@ -24,7 +24,7 @@ function User (user) {
this.team = user['team']; this.team = user['team'];
this.bans = user['bans']; this.bans = user['bans'];
this.steam = { this.steam = {
id: null, id: user['steam']['id'] || null,
url: user['steam']['url'] || null, url: user['steam']['url'] || null,
nickname: user['steam']['nickname'] || null nickname: user['steam']['nickname'] || null
}; };
@ -34,7 +34,6 @@ function User (user) {
}; };
if (this.steam.url) { if (this.steam.url) {
this.steam.id = this.getSteamId();
this.hive.id = this.getHiveId(); this.hive.id = this.getHiveId();
} }
} }
@ -47,7 +46,7 @@ User.prototype.getSteamId = () => {
}; };
User.prototype.getHiveId = () => { User.prototype.getHiveId = () => {
var steamId = this.getSteamId(); var steamId = this.steam.id;
if (!steamId) return null; if (!steamId) return null;
var index = steamId.match(/:0:/) ? 0 : 1; var index = steamId.match(/:0:/) ? 0 : 1;
var tailId = parseInt(steamId.match(/\d*$/), 10); var tailId = parseInt(steamId.match(/\d*$/), 10);