Skip to content

Commit

Permalink
fix axiosConfig param
Browse files Browse the repository at this point in the history
  • Loading branch information
shrpne committed Nov 15, 2018
1 parent 84c8397 commit b4c2660
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
@@ -1,5 +1,3 @@
## 0.0.2 - 2018-11-07
- fix path

## 0.0.1 - 2018-11-07
- initial
- wip
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "minter-js-org",
"version": "0.0.3",
"version": "0.0.4",
"description": "Communicate with minter.org user database through it API",
"main": "src/index.js",
"files": [
Expand Down
37 changes: 19 additions & 18 deletions src/index.js
Expand Up @@ -39,9 +39,10 @@ export default function MinterOrg(options) {
* @param {string} [data.language]
* @param {UserAvatar} [data.avatar]
* @param {boolean} login - should make login
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise<User|{confirmations: Array}>}
*/
this.register = function register(data, login) {
this.register = function register(data, login, axiosConfig) {
// generate mnemonic if not specified
const mnemonic = data.mnemonic ? data.mnemonic : generateMnemonic();

Expand All @@ -56,9 +57,9 @@ export default function MinterOrg(options) {

if (login) {
return new Promise((resolve, reject) => {
instance.post('register', userData)
instance.post('register', userData, axiosConfig)
.then(() => {
this.login(data)
this.login(data, axiosConfig)
.then((authData) => {
resolve({
...authData,
Expand All @@ -70,16 +71,16 @@ export default function MinterOrg(options) {
.catch(reject);
});
} else {
return instance.post('register', userData)
return instance.post('register', userData, axiosConfig)
.then((response) => response.data.data);
}
};

/**
* @param username
* @param password
* @param {AxiosRequestConfig} axiosConfig
* @return {Promise<User>}
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise<User|{password: string}>}
*/
this.login = function login({username, password}, axiosConfig) {
const passwordToStore = getPasswordToStore(password);
Expand All @@ -97,7 +98,7 @@ export default function MinterOrg(options) {

/**
* Requires auth
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise<User>}
*/
this.getProfile = function getProfile(axiosConfig) {
Expand All @@ -112,7 +113,7 @@ export default function MinterOrg(options) {
* @param {string} [profile.name]
* @param {string} [profile.email]
* @param {string} [profile.language]
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise<{confirmations: Array}>}
*/
this.updateProfile = function updateProfile(profile, axiosConfig) {
Expand All @@ -125,7 +126,7 @@ export default function MinterOrg(options) {
* Requires auth
* @param {string} oldPasswordToStore
* @param {string} newPasswordToStore
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise<Array<Address>>}
*/
this.updateProfilePassword = function updateProfilePassword(oldPasswordToStore, newPasswordToStore, axiosConfig) {
Expand All @@ -152,7 +153,7 @@ export default function MinterOrg(options) {
/**
* Requires auth
* @param {Blob|File} avatar - image, max 0.5 MB, max 500x500
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise<UserAvatar>}
*/
this.updateProfileAvatar = function updateProfileAvatar(avatar, axiosConfig) {
Expand All @@ -166,7 +167,7 @@ export default function MinterOrg(options) {

/**
* Requires auth
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise<UserAvatar>}
*/
this.deleteProfileAvatar = function deleteProfileAvatar(axiosConfig) {
Expand All @@ -177,7 +178,7 @@ export default function MinterOrg(options) {
* Get profile address by id without encrypted data
* Requires auth
* @param {number} id
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise<Address>}
*/
this.getProfileAddress = function getProfileAddress(id, axiosConfig) {
Expand All @@ -189,7 +190,7 @@ export default function MinterOrg(options) {
* Get profile address by id with encrypted data
* Requires auth
* @param {number} id
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise<Address>}
*/
this.getProfileAddressEncrypted = function getProfileAddressEncrypted(id, axiosConfig) {
Expand All @@ -200,7 +201,7 @@ export default function MinterOrg(options) {
/**
* Requires auth
* @param {Address} address
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise}
*/
this.addProfileAddress = function addProfileAddress(address, axiosConfig) {
Expand All @@ -211,7 +212,7 @@ export default function MinterOrg(options) {
* Requires auth
* @param {number} id
* @param {Address} address
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise}
*/
this.updateProfileAddress = function updateProfileAddress(id, address, axiosConfig) {
Expand All @@ -221,7 +222,7 @@ export default function MinterOrg(options) {
/**
* Requires auth
* @param {number} id
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise}
*/
this.deleteProfileAddress = function deleteProfileAddress(id, axiosConfig) {
Expand All @@ -231,7 +232,7 @@ export default function MinterOrg(options) {
/**
* Get addresses saved in profile without encrypted data
* Requires auth
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise<Array<Address>>}
*/
this.getProfileAddressList = function getProfileAddressList(axiosConfig) {
Expand All @@ -242,7 +243,7 @@ export default function MinterOrg(options) {
/**
* Get addresses saved in profile with encrypted data
* Requires auth
* @param {AxiosRequestConfig} axiosConfig
* @param {AxiosRequestConfig} [axiosConfig]
* @return {Promise<Array<Address>>}
*/
this.getProfileAddressListEncrypted = function getProfileAddressListEncrypted(axiosConfig) {
Expand Down

0 comments on commit b4c2660

Please sign in to comment.