esoftplay 0.0.117-c → 0.0.117-d
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/modules/user/class.ts +4 -8
- package/package.json +1 -1
package/modules/user/class.ts
CHANGED
|
@@ -8,16 +8,15 @@ import { Platform } from 'react-native';
|
|
|
8
8
|
import useGlobalState from '../../global';
|
|
9
9
|
import moment from "../../moment";
|
|
10
10
|
|
|
11
|
-
const state = useGlobalState?.(null)
|
|
11
|
+
const state = useGlobalState?.(null, { persistKey: "user" })
|
|
12
12
|
|
|
13
13
|
export default class eclass {
|
|
14
14
|
static state(): useGlobalReturn<any> {
|
|
15
15
|
return state
|
|
16
16
|
}
|
|
17
17
|
static create(user: any): Promise<void> {
|
|
18
|
-
return new Promise(
|
|
18
|
+
return new Promise((r, j) => {
|
|
19
19
|
state?.set?.(user)
|
|
20
|
-
await AsyncStorage.setItem('user', JSON.stringify(user))
|
|
21
20
|
if (esp.config('notification') == 1) {
|
|
22
21
|
UserClass.pushToken()
|
|
23
22
|
}
|
|
@@ -27,11 +26,8 @@ export default class eclass {
|
|
|
27
26
|
|
|
28
27
|
static load(callback?: (user?: any | null) => void): Promise<any> {
|
|
29
28
|
return new Promise((r, j) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (callback) callback(_user)
|
|
33
|
-
r(_user)
|
|
34
|
-
})
|
|
29
|
+
if (callback) callback(state?.get?.())
|
|
30
|
+
r((state?.get?.()))
|
|
35
31
|
})
|
|
36
32
|
}
|
|
37
33
|
|