Hi guys, i'm new in programming so bear with me. Need some help on calling
API using angularjs here, and I think this have some problem with JSON Web
Tokens; when trying to calling the API i get:
Login Object {success: true, data: Object}
Object {success: false, error: "User not logged in
$scope.login = function () {
var url = "";
url = 'http://localhost.net/api/login';
$.post(url, {email: "admin", password: "admin"}, function (data)
{
console.log("Login", data);
url = 'http://localhost.net/api/device/get';
$.post(url, {}, function (data)
{
console.log("Devices", data);
}).fail(function (data) {
console.log("Devices", "login_failed");
});
url = 'http://localhost.net/api/async';
$.post(url, {}, function (data)
{
console.log("Live Data", data);
}).fail(function (data) {
console.log("Live Data", "login_failed");
});
url = 'http://localhost.net/api/command/send';
$.post(url, {deviceId: 2, type: "Stop"}, function (data)
{
console.log("Command", data);
}).fail(function (data) {
console.log("Command", "login_failed");
});
}).fail(function (data) {
console.log("Login", "login_failed");
});
};
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.