diff --git a/src/_services/network.service.js b/src/_services/network.service.js index f79b281..d161cbd 100644 --- a/src/_services/network.service.js +++ b/src/_services/network.service.js @@ -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')); } diff --git a/src/_store/networks.module.js b/src/_store/networks.module.js index d02432d..71e7fc9 100644 --- a/src/_store/networks.module.js +++ b/src/_store/networks.module.js @@ -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)); },