summaryrefslogtreecommitdiff
path: root/src/client/app/common/mios.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/app/common/mios.ts')
-rw-r--r--src/client/app/common/mios.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/client/app/common/mios.ts b/src/client/app/common/mios.ts
index 7baf974adf..5e0c7d2f3b 100644
--- a/src/client/app/common/mios.ts
+++ b/src/client/app/common/mios.ts
@@ -444,23 +444,28 @@ export default class MiOS extends EventEmitter {
// Append a credential
if (this.isSignedIn) (data as any).i = this.i.token;
- // TODO
- //const viaStream = localStorage.getItem('enableExperimental') == 'true';
+ const viaStream = localStorage.getItem('enableExperimental') == 'true';
return new Promise((resolve, reject) => {
- /*if (viaStream) {
+ if (viaStream) {
const stream = this.stream.borrow();
const id = Math.random().toString();
+
stream.once(`api-res:${id}`, res => {
- resolve(res);
+ if (res.res) {
+ resolve(res.res);
+ } else {
+ reject(res.e);
+ }
});
+
stream.send({
type: 'api',
id,
endpoint,
data
});
- } else {*/
+ } else {
const req = {
id: uuid(),
date: new Date(),