From cf9d226c90765cc268faed5e5b8b9c2e8eae8807 Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Tue, 14 Jul 2020 12:56:37 +0200 Subject: [PATCH] Fix parsing of downloading network key --- src/_services/network.service.js | 4 +++- src/_store/networks.module.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) 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)); },