Cache API

This commit is contained in:
2023-04-29 18:23:20 -04:00
parent a3413e382c
commit a83e8cb22c
5 changed files with 89 additions and 54 deletions

View File

@@ -14,19 +14,11 @@ export async function close(cid) {
})).json();
}
export async function call(cid, method, ...params) {
export async function call(cid, body) {
return await (await fetch('/v1/vista/' + cid, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ method: method, params: params, id: Date.now() })
})).json();
}
export async function callctx(cid, context, method, ...params) {
return await (await fetch('/v1/vista/' + cid, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ method: method, params: params, context: context, id: Date.now() })
body: JSON.stringify(body)
})).json();
}
@@ -55,5 +47,5 @@ export async function authenticate(cid, avcode=null) {
}
export default window.vista = {
connect, close, call, callctx, serverinfo, userinfo, authenticate
connect, close, call, serverinfo, userinfo, authenticate
};