tfa-node-sdk
Advanced tools
Comparing version 1.1.0 to 1.1.2
@@ -11,6 +11,16 @@ const axios = require('axios'); | ||
.then((response) => { | ||
return response; | ||
const data = { | ||
status: response.status, | ||
data: response.data, | ||
} | ||
return data; | ||
}) | ||
.catch((error) => { | ||
return error; | ||
const data = { | ||
status: error.response.status, | ||
data: error.response.data, | ||
} | ||
return data; | ||
}); | ||
@@ -17,0 +27,0 @@ } |
@@ -13,6 +13,16 @@ import axios from 'axios'; | ||
.then((response) => { | ||
return response; | ||
const data = { | ||
status: response.status, | ||
data: response.data, | ||
} | ||
return data; | ||
}) | ||
.catch((error) => { | ||
return error; | ||
const data = { | ||
status: error.response.status, | ||
data: error.response.data, | ||
} | ||
return data; | ||
}); | ||
@@ -19,0 +29,0 @@ } |
{ | ||
"name": "tfa-node-sdk", | ||
"version": "1.1.0", | ||
"version": "1.1.2", | ||
"description": "Telegram Factor Authentication node library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -53,10 +53,10 @@ # Telegram Factor Authentication - Node SDK | ||
result.then((result) => { | ||
const resultObject = result.response.data; | ||
const statCode = result.response.status; | ||
const data = result.data; | ||
const statCode = result.status; | ||
if (statCode === 200) { | ||
console.log('Authenticated.'); | ||
const user = resultObject.user; | ||
const user = data.user; | ||
console.log(user); | ||
} else { | ||
console.log(resultObject.message); | ||
console.log(data.message); | ||
} | ||
@@ -78,3 +78,2 @@ }); | ||
{ | ||
"error": 800, | ||
"user": { | ||
@@ -81,0 +80,0 @@ "_id": "document id", |
const tfa = require('tfa-node-sdk'); | ||
const auth = new tfa('ZmErsKQcfaODiKAZdopcwQEjW'); | ||
const auth = new tfa('WuBjwvrQencoplabrUtPvDKaz'); | ||
const result = auth.authUser('PemBvQIQBjSxKQrChoFRDzCoh'); | ||
const result = auth.authUser('uAMGSFEFDQUevEHWulAMHIBtz'); | ||
result.then((result) => { | ||
const resultObject = result.response.data; | ||
const statCode = result.response.status; | ||
const data = result.data; | ||
const statCode = result.status; | ||
if (statCode === 200) { | ||
console.log('Authenticated.'); | ||
const user = resultObject.user; | ||
const user = data.user; | ||
console.log(user); | ||
} else { | ||
console.log(resultObject.message); | ||
console.log(data.message); | ||
} | ||
}); |
7122
59
135