Proxy dashboard API through web server
This commit is contained in:
parent
72b9174401
commit
148ffec10f
1 changed files with 10 additions and 3 deletions
|
|
@ -368,7 +368,7 @@
|
|||
<div id="toast" class="toast"></div>
|
||||
|
||||
<script>
|
||||
const API = 'http://127.0.0.1:30010';
|
||||
const API_PROXY = '/api/proxy';
|
||||
const PREFERRED_PRESET = 'RCP_LedVolumeLive';
|
||||
const state = {
|
||||
presetId: '',
|
||||
|
|
@ -409,8 +409,15 @@
|
|||
}
|
||||
|
||||
async function api(path, options = {}) {
|
||||
const response = await fetch(API + path, {
|
||||
...options,
|
||||
const method = (options.method || 'GET').toUpperCase();
|
||||
const payload = {
|
||||
method,
|
||||
url: path,
|
||||
body: options.body ? JSON.parse(options.body) : undefined
|
||||
};
|
||||
const response = await fetch(API_PROXY, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(payload),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...(options.headers || {})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue