(command, data = {})
| 55 | } |
| 56 | |
| 57 | export function postAPI (command, data = {}) { |
| 58 | const params = new URLSearchParams() |
| 59 | params.append('command', command) |
| 60 | params.append('response', 'json') |
| 61 | if (data) { |
| 62 | Object.entries(data).forEach(([key, value]) => { |
| 63 | if (value !== undefined && value !== null) { |
| 64 | params.append(key, value) |
| 65 | } |
| 66 | }) |
| 67 | } |
| 68 | |
| 69 | const sessionkey = vueProps.$localStorage.get(ACCESS_TOKEN) || Cookies.get('sessionkey') |
| 70 | if (sessionkey) { |
| 71 | params.append('sessionkey', sessionkey) |
| 72 | } |
| 73 | return axios({ |
| 74 | url: '/', |
| 75 | method: 'POST', |
| 76 | data: params |
| 77 | }) |
| 78 | } |
| 79 | |
| 80 | export function callAPI (command, args = {}) { |
| 81 | const isGetAPICommand = getAPICommandsRegex.test(command) || additionalGetAPICommandsList.includes(command.toLowerCase()) |
no test coverage detected