Browse Source

Fix parsing of downloading network key

pull/16/head
Kristijan Mitrovic 4 years ago
parent
commit
cf9d226c90
2 changed files with 4 additions and 2 deletions
  1. +3
    -1
      src/_services/network.service.js
  2. +1
    -1
      src/_store/networks.module.js

+ 3
- 1
src/_services/network.service.js View File

@@ -80,9 +80,11 @@ function requestNetworkKeys(userId, networkId, messages, errors) {
return fetch(`${config.apiUrl}/users/${userId}/networks/${networkId}/actions/keys`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors));
}

function retrieveNetworkKeys(userId, networkId, code, password) {
function retrieveNetworkKeys(userId, networkId, code, password, messages, errors) {
return fetch(`${config.apiUrl}/users/${userId}/networks/${networkId}/actions/keys/${code}`,
util.postWithAuth({ name: 'password', value: password }))
.then(util.handleCrudResponse(messages, errors))
.then(netKeyObj => netKeyObj.data)
.then(util.handleDataToDownloadAsFile('restore.' + networkId + '.key', 'text/plain'));
}



+ 1
- 1
src/_store/networks.module.js View File

@@ -149,7 +149,7 @@ const actions = {

retrieveNetworkKeys({ commit }, {userId, networkId, code, password, messages, errors}) {
commit('retrieveNetworkKeysRequest');
networkService.retrieveNetworkKeys(userId, networkId, code, password)
networkService.retrieveNetworkKeys(userId, networkId, code, password, messages, errors)
.then(ok => commit('retrieveNetworkKeysSuccess'),
error => commit('retrieveNetworkKeysFailure', error));
},


Loading…
Cancel
Save