Comments (17)
Make sure you have the latest version with npm i call-of-duty-api@latest
.
This issue was fixed with the latest release.
from node-callofduty.
I have updated to the latest update and I've got the same error
from node-callofduty.
Can you send an example of the whole script you are using?
from node-callofduty.
var express = require('express');
var router = express.Router();
const API = require('call-of-duty-api')();
router.get('/:username/:game', function(req, res, next) {
var username = req.params.username;
var game = req.params.game;
var apiGame = API.platforms.battle;
console.log(apiGame);
if (game == "battle") {
apiGame = API.platforms.battle;
}
else if (game == "steam") {
apiGame = API.platforms.steam;
}
else if (game == "psn") {
apiGame = API.platforms.psn;
}
function receiveStats() {
API.MWwz(username, apiGame).then(data => {
console.log(data); // see output
return res.status(202).json({
"error": "nil",
"response": data
});
}).catch (err => {
console.log(err);
return res.status(202).json({
"error": err,
"response": "nil"
});
});
}
receiveStats();
});
module.exports = router;
from node-callofduty.
Have you got an example user?
This is my test case which works as intended.
const api = require('call-of-duty-api')();
const user = "Lierrmm425324";
test = () => {
let username = user;
let apiGame = api.platforms.battle;
api.MWwz(username, apiGame).then(data => {
console.log(data); // see output
return JSON.stringify({
"error": "nil",
"response": data
});
}).catch (err => {
console.log(err);
return JSON.stringify({
"error": err,
"response": "nil"
});
});
};
console.log(test());
output
[ br: {}, br_dmz: {}, br_all: {} ]
from node-callofduty.
Its giving error with your username too with my code.
I got same error with your code
from node-callofduty.
What version of the api are you using? it will say in package.json
from node-callofduty.
1.0.25
from node-callofduty.
Hmm, Weird.
I'd suggest doing a clean uninstall so npm uninstall call-of-duty-api
and
then npm i call-of-duty-api@latest
.
from node-callofduty.
Done, same error...
function receiveStats() {
test = () => {
API.MWwz("Lierrmm425324", API.platforms.battle).then(data => {
console.log(data); // see output
return JSON.stringify({
"error": "nil",
"response": data
});
}).catch (err => {
console.log(err);
return JSON.stringify({
"error": err,
"response": "nil"
});
});
};
console.log(test());
}
Error:
Cannot read property 'mode' of undefined call-of-duty-api/index.js:187:41
from node-callofduty.
Can you navigate to node_modules/call-of-duty-api/index.js and go to line 187 and send a screenshot please.
from node-callofduty.
module.MWwz = function (gamertag, platform = config.platform) {
return new Promise((resolve, reject) => {
brDetails = [];
brDetails.br = {};
brDetails.br_dmz = {};
brDetails.br_all = {};
this.MWmp(gamertag, platform).then((data) => {
if(typeof data.lifetime.mode.br) { data.lifetime.mode.br.properties.title = "br"; brDetails.br = data.lifetime.mode.br.properties; }
if(typeof data.lifetime.mode.br_dmz) { data.lifetime.mode.br_dmz.properties.title = "br_dmz"; brDetails.br_dmz = data.lifetime.mode.br_dmz.properties; }
if(typeof data.lifetime.mode.br_all) { data.lifetime.mode.br_all.properties.title = "br_all"; brDetails.br_all = data.lifetime.mode.br_all.properties; }
resolve(brDetails);
}).catch(e => reject(e));
});
};
Line 187: if(typeof data.lifetime.mode.br) { data.lifetime.mode.br.properties.title = "br"; brDetails.br = data.lifetime.mode.br.properties; }
from node-callofduty.
Yes, that is not on the latest version. If you look at this line you can see the implemented fix:
Line 187 in 247a5ee
from node-callofduty.
Is your npm updated or its updated only on GitHub?
from node-callofduty.
It was updated on NPM too.
I have published it again, could you try updating it to 1.0.26 please
from node-callofduty.
I'll try soon.
I've edited it manually for now and its retrieving null stats for all username.
Have you got some username to test with?
from node-callofduty.
Lierrmm#2364
from node-callofduty.
Related Issues (20)
- Getting SSO Token HOT 1
- Captcha HOT 3
- User weapons API HOT 1
- README.md has an unclickable link in text
- Is it possible to add cod mobile? HOT 1
- Cannot get successful response using endpoints that require unoId HOT 1
- Uno ID? HOT 1
- Login with 2fa enabled HOT 2
- Cold War API ? HOT 3
- Response data properties are not consistent between games (MW & CW) HOT 2
- Match Details Endpoints HOT 1
- Always returns 401 - Unauthorized. Incorrect username or password. Even though my username and password is right! HOT 4
- api.login is not a function
- Not permitted: not allowed HOT 12
- 404 - Not found. Incorrect username or platform? Misconfigured privacy settings? HOT 3
- Recaptcha error on login HOT 1
- Error: 401 - Unauthorized. Incorrect username or password HOT 3
- 401 - Unauthorized. Incorrect username or password. HOT 2
- Login failing HOT 4
- Add call to retrieve lookup values HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-callofduty.