Skip to content

Commit 547cb7a

Browse files
authored
Merge pull request #58 from CloudBoltSoftware/bugfix/ENG-23850-uncaught-cancelled-error
Bugfix/eng 23850 uncaught cancelled error
2 parents b8af79e + bef2794 commit 547cb7a

File tree

4 files changed

+8
-25
lines changed

4 files changed

+8
-25
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudbolt/cb-api-helper",
3-
"version": "0.5.6",
3+
"version": "0.5.7",
44
"scripts": {
55
"co:login": "aws sso login && aws codeartifact login --tool npm --repository cloudbolt-npm --domain cloudbolt --domain-owner 499620025628",
66
"husky:install": "husky install",
Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { baseApi } from '../../../baseApi'
2-
import ResponseParser from '../../../helpers/ResponseParser'
1+
import crud from '../../../crudOperations'
32

43
const statusURL = 'v3/cmp/system/status'
54
const settingsURL = 'v3/cmp/system/settings'
@@ -9,27 +8,11 @@ export default {
98
* Retrieve System Status to display on the System Status Widget
109
* @returns {Promise} API Response object of System Status objects
1110
*/
12-
status: async () => {
13-
try {
14-
const response = await baseApi.get(statusURL)
15-
return response
16-
} catch (error) {
17-
const errMsg = ResponseParser.getErrorMessage(error)
18-
throw new Error(errMsg)
19-
}
20-
},
11+
status: (options) => crud.getItemByEndpoint(statusURL, options),
2112

2213
/**
2314
* Retrieve System Settings to display on the System Settings Widget
2415
* @returns {Promise} API Response object of System Settings objects
2516
*/
26-
settings: async () => {
27-
try {
28-
const response = await baseApi.get(settingsURL)
29-
return response
30-
} catch (error) {
31-
const errMsg = ResponseParser.getErrorMessage(error)
32-
throw new Error(errMsg)
33-
}
34-
}
17+
settings: (options) => crud.getItemByEndpoint(settingsURL, options)
3518
}

src/api/services/v3/cmp/SystemService.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import SystemService from './SystemService'
44
test('status calls the correct endpoint', async () => {
55
const mockFn = jest.spyOn(baseApi, 'get').mockResolvedValue({})
66
await SystemService.status()
7-
expect(mockFn).toHaveBeenCalledWith('v3/cmp/system/status')
7+
expect(mockFn).toHaveBeenCalledWith('/v3/cmp/system/status/')
88
})
99

1010
test('settings calls the correct endpoint', async () => {
1111
const mockFn = jest.spyOn(baseApi, 'get').mockResolvedValue({})
1212
await SystemService.settings()
13-
expect(mockFn).toHaveBeenCalledWith('v3/cmp/system/settings')
13+
expect(mockFn).toHaveBeenCalledWith('/v3/cmp/system/settings/')
1414
})

0 commit comments

Comments
 (0)