(
command: string,
...args: string[]
)
| 122 | }); |
| 123 | |
| 124 | export async function runCommand( |
| 125 | command: string, |
| 126 | ...args: string[] |
| 127 | ): Promise<any> { |
| 128 | const response = await fetchApi(`/commands/${command}`, { |
| 129 | method: "POST", |
| 130 | headers: { |
| 131 | "Content-Type": "application/json", |
| 132 | }, |
| 133 | body: JSON.stringify({ arguments: args }), |
| 134 | }); |
| 135 | return await response.json(); |
| 136 | } |
| 137 | |
| 138 | // deep comparison of two json objects (dicts). arrays are handeled as a single value. |
| 139 | // return: json object including only the changed keys value pairs. |