oauth-request-client
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -16,16 +16,14 @@ "use strict"; | ||
return _regenerator["default"].wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return _services.axios.get(_constants.endPoints.getProfile).then(function (res) { | ||
return res.data; | ||
}); | ||
case 2: | ||
data = _context.sent; | ||
return _context.abrupt("return", data); | ||
case 4: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return _services.axios.get(_constants.endPoints.getProfile).then(function (res) { | ||
return res.data; | ||
}); | ||
case 2: | ||
data = _context.sent; | ||
return _context.abrupt("return", data); | ||
case 4: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
@@ -32,0 +30,0 @@ }, _callee); |
@@ -12,31 +12,29 @@ "use strict"; | ||
var _constants = require("../../_constants"); | ||
var getUserData = /*#__PURE__*/function () { | ||
var login = /*#__PURE__*/function () { | ||
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(mail, password) { | ||
var data; | ||
return _regenerator["default"].wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return _services.axios.post(_constants.endPoints.login, { | ||
password: password, | ||
mail: mail | ||
}).then(function (res) { | ||
return res.data; | ||
}); | ||
case 2: | ||
data = _context.sent; | ||
return _context.abrupt("return", data); | ||
case 4: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return _services.axios.post(_constants.endPoints.login, { | ||
password: password, | ||
mail: mail | ||
}).then(function (res) { | ||
return res.data; | ||
}); | ||
case 2: | ||
data = _context.sent; | ||
return _context.abrupt("return", data); | ||
case 4: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee); | ||
})); | ||
return function getUserData(_x, _x2) { | ||
return function login(_x, _x2) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
var _default = getUserData; | ||
var _default = login; | ||
exports["default"] = _default; |
@@ -14,10 +14,8 @@ "use strict"; | ||
return _regenerator["default"].wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_services.axios.defaults.headers.common['x-access-token'] = ""; | ||
case 1: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
_services.axios.defaults.headers.common['x-access-token'] = ""; | ||
case 1: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
@@ -24,0 +22,0 @@ }, _callee); |
@@ -17,34 +17,32 @@ "use strict"; | ||
return _regenerator["default"].wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
userToken = token; | ||
if (!userToken) { | ||
_context.next = 7; | ||
break; | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
userToken = token; | ||
if (!userToken) { | ||
_context.next = 7; | ||
break; | ||
} | ||
_context.next = 4; | ||
return _services.axios.get(_constants.endPoints.verifyToken, { | ||
params: { | ||
token: userToken | ||
} | ||
_context.next = 4; | ||
return _services.axios.get(_constants.endPoints.verifyToken, { | ||
params: { | ||
token: userToken | ||
} | ||
}).then(function (res) { | ||
return res.data; | ||
}); | ||
case 4: | ||
data = _context.sent; | ||
if ((0, _utils.isSuccessRequest)(data)) { | ||
_services.axios.defaults.headers.common['x-access-token'] = userToken; | ||
} | ||
return _context.abrupt("return", data); | ||
case 7: | ||
; | ||
return _context.abrupt("return", { | ||
code: 400, | ||
message: "userToken not found" | ||
}); | ||
case 9: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}).then(function (res) { | ||
return res.data; | ||
}); | ||
case 4: | ||
data = _context.sent; | ||
if ((0, _utils.isSuccessRequest)(data)) { | ||
_services.axios.defaults.headers.common['x-access-token'] = userToken; | ||
} | ||
return _context.abrupt("return", data); | ||
case 7: | ||
; | ||
return _context.abrupt("return", { | ||
code: 400, | ||
message: "userToken not found" | ||
}); | ||
case 9: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
@@ -51,0 +49,0 @@ }, _callee); |
@@ -0,0 +0,0 @@ { |
{ | ||
"name": "oauth-request-client", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "371Digital oAuth Request Client", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,0 +0,0 @@ # 371Digital oAuth Request Client |
@@ -0,0 +0,0 @@ const oauthApiIP = "https://oauth.371digital.com/v1/"; |
@@ -0,0 +0,0 @@ import { login, verifyToken, getUserData, logout } from "./methods"; |
@@ -0,0 +0,0 @@ import { axios } from "services"; |
@@ -0,0 +0,0 @@ import login from "./login"; |
import { axios } from "services"; | ||
import { endPoints } from "_constants"; | ||
const getUserData = async (mail, password) => { | ||
const login = async (mail, password) => { | ||
const data = await axios.post(endPoints.login, { | ||
@@ -13,2 +13,2 @@ password, | ||
export default getUserData; | ||
export default login; |
@@ -0,0 +0,0 @@ import { axios } from "services"; |
@@ -0,0 +0,0 @@ import { axios } from "services"; |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ import axios from "./axios"; |
Sorry, the diff of this file is not supported yet
25
13124
338