u
This commit is contained in:
@@ -8,6 +8,7 @@ import brandAutomat from '../automats/brandAutomat';
|
||||
import unitAutomat from '../automats/unitAutomat';
|
||||
import authAutomat from '../automats/authAutomat';
|
||||
import categoryAutomat from '../automats/categoryAutomat';
|
||||
import posterminalAutomat from '../automats/posterminalAutomat';
|
||||
|
||||
|
||||
/**
|
||||
@@ -458,6 +459,22 @@ export class StorageManager extends ApiClient {
|
||||
/** Reload units from API. */
|
||||
updateUnit: { value: () => unitAutomat.actions.load() },
|
||||
|
||||
/** Posterminal list from posterminalAutomat. */
|
||||
posterminals: { get: () => posterminalAutomat.state.terminals },
|
||||
/** Promise that resolves when posterminals are first loaded. */
|
||||
posterminalPromise: {
|
||||
get: () => posterminalAutomat.state.status === 'succeeded'
|
||||
? Promise.resolve(posterminalAutomat.state.terminals)
|
||||
: new Promise((resolve, reject) => {
|
||||
const unsub = posterminalAutomat.subscribe((s) => {
|
||||
if (s.status === 'succeeded') { unsub(); resolve(s.terminals); }
|
||||
else if (s.status === 'failed') { unsub(); reject(new Error(s.error)); }
|
||||
});
|
||||
}),
|
||||
},
|
||||
/** Reload posterminals from API. */
|
||||
updatePosterminal: { value: () => posterminalAutomat.actions.load() },
|
||||
|
||||
/**
|
||||
* Current company object from companyAutomat, or null.
|
||||
* Previously: companies array from GET /api/company.
|
||||
|
||||
Reference in New Issue
Block a user