@webqit/webflo 1.0.33 → 1.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -6,18 +6,22 @@ export class HttpUser extends WebfloStorage {
|
|
|
6
6
|
return new this(request, session, client);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
#session;
|
|
9
10
|
#client;
|
|
10
11
|
|
|
11
12
|
constructor(request, session, client) {
|
|
12
13
|
super(session, '#user', request, session);
|
|
14
|
+
this.#session = session;
|
|
13
15
|
this.#client = client;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
async isSignedIn() {
|
|
19
|
+
await this.#session.refresh();
|
|
17
20
|
return await this.has('id');
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
async signIn(...args) {
|
|
24
|
+
await this.#session.refresh();
|
|
21
25
|
return await this.require(
|
|
22
26
|
['id'].concat(typeof args[0] === 'string' || Array.isArray(args[0]) ? args.unshift() : []),
|
|
23
27
|
...args
|
|
@@ -26,6 +30,7 @@ export class HttpUser extends WebfloStorage {
|
|
|
26
30
|
|
|
27
31
|
async signOut() {
|
|
28
32
|
await this.clear();
|
|
33
|
+
await this.#session.commit();
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
async confirm(data, callback, options = {}) {
|
|
@@ -27,6 +27,12 @@ export class WebfloStorage {
|
|
|
27
27
|
return this.#store;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
async refresh() {
|
|
31
|
+
let $store;
|
|
32
|
+
if (!this.#store || !($store = await this.#registry.get(this.#key))) return;
|
|
33
|
+
Object.assign(this.#store, $store);
|
|
34
|
+
}
|
|
35
|
+
|
|
30
36
|
async commit() {
|
|
31
37
|
if (this.#store && this.#key && this.#modified) {
|
|
32
38
|
await this.#registry.set(this.#key, this.#store);
|