Replace fixed paths with response from API
Currently, the Redfish request used fixed URIs, modify the code to use
the BMC and System paths got from response of API calls.
For CertificateStore, since it was using the URL for constant variable
assignment, changed the constant CERTIFICATE_TYPES to method call.
Change-Id: I330b7272083e3e6993aae5705aae170b8e9a4659
Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
diff --git a/src/store/modules/Settings/DateTimeStore.js b/src/store/modules/Settings/DateTimeStore.js
index 51b722a..9d804a7 100644
--- a/src/store/modules/Settings/DateTimeStore.js
+++ b/src/store/modules/Settings/DateTimeStore.js
@@ -19,7 +19,7 @@
actions: {
async getNtpData({ commit }) {
return await api
- .get('/redfish/v1/Managers/bmc/NetworkProtocol')
+ .get(`${await this.dispatch('global/getBmcPath')}/NetworkProtocol`)
.then((response) => {
const ntpServers = response.data.NTP.NTPServers;
const isNtpProtocolEnabled = response.data.NTP.ProtocolEnabled;
@@ -40,7 +40,10 @@
ntpData.NTP.NTPServers = dateTimeForm.ntpServersArray;
}
return await api
- .patch(`/redfish/v1/Managers/bmc/NetworkProtocol`, ntpData)
+ .patch(
+ `${await this.dispatch('global/getBmcPath')}/NetworkProtocol`,
+ ntpData,
+ )
.then(async () => {
if (!dateTimeForm.ntpProtocolEnabled) {
const dateTimeData = {
@@ -58,9 +61,12 @@
*/
const timeoutVal = state.isNtpProtocolEnabled ? 20000 : 0;
return await new Promise((resolve, reject) => {
- setTimeout(() => {
+ setTimeout(async () => {
return api
- .patch(`/redfish/v1/Managers/bmc`, dateTimeData)
+ .patch(
+ `${await this.dispatch('global/getBmcPath')}`,
+ dateTimeData,
+ )
.then(() => resolve())
.catch(() => reject());
}, timeoutVal);