pocketbase-react 0.1.8 → 0.1.9
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/dist/pocketbase-react.js +103 -24
- package/dist/pocketbase-react.min.js +3 -3
- package/es/context/Pocketbase.d.ts +2 -4
- package/es/context/Pocketbase.js +7 -9
- package/es/context/auth.d.ts +38 -0
- package/es/context/auth.js +67 -0
- package/es/context/index.d.ts +1 -0
- package/es/context/index.js +1 -0
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.js +2 -1
- package/es/hooks/useAuth.d.ts +4 -0
- package/es/hooks/useAuth.js +8 -0
- package/es/service/Authentication.d.ts +23 -0
- package/es/service/Authentication.js +32 -0
- package/es/service/Storage.d.ts +5 -0
- package/es/service/Storage.js +20 -0
- package/es/store/store.js +7 -19
- package/lib/context/Pocketbase.js +6 -8
- package/lib/context/auth.js +74 -0
- package/lib/context/index.js +11 -0
- package/lib/hooks/index.js +11 -0
- package/lib/hooks/useAuth.js +12 -0
- package/lib/service/Authentication.js +37 -0
- package/lib/service/Storage.js +26 -0
- package/lib/store/store.js +7 -19
- package/package.json +1 -1
- package/src/context/Pocketbase.tsx +9 -14
- package/src/context/auth.tsx +113 -0
- package/src/context/index.ts +2 -1
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useAuth.ts +7 -0
- package/src/service/Authentication.ts +50 -0
- package/src/service/Storage.ts +23 -0
- package/src/store/store.tsx +7 -21
package/src/store/store.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { appReducer } from './reducers';
|
|
|
5
5
|
import thunk from 'redux-thunk';
|
|
6
6
|
import { RecordAction } from './reducers/records';
|
|
7
7
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
8
|
+
import { StorageService } from '../service/Storage';
|
|
8
9
|
|
|
9
10
|
interface Storage {
|
|
10
11
|
getItem(key: string, ...args: Array<any>): any;
|
|
@@ -14,29 +15,14 @@ interface Storage {
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
const CustomStorage: Storage = {
|
|
17
|
-
getItem: async (
|
|
18
|
-
|
|
19
|
-
return localStorage.getItem(_key);
|
|
20
|
-
}
|
|
21
|
-
else if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
|
|
22
|
-
return await AsyncStorage.getItem(_key);
|
|
23
|
-
}
|
|
18
|
+
getItem: async (key: string, ..._args: Array<any>) => {
|
|
19
|
+
return await StorageService.get(key);
|
|
24
20
|
},
|
|
25
|
-
setItem: async (
|
|
26
|
-
|
|
27
|
-
return localStorage.setItem(_key, _value);
|
|
28
|
-
}
|
|
29
|
-
else if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
|
|
30
|
-
return await AsyncStorage.setItem(_key, _value);
|
|
31
|
-
}
|
|
21
|
+
setItem: async (key: string, value: any, ..._args: Array<any>) => {
|
|
22
|
+
return StorageService.set(key, value);
|
|
32
23
|
},
|
|
33
|
-
removeItem: async (
|
|
34
|
-
|
|
35
|
-
return localStorage.removeItem(_key);
|
|
36
|
-
}
|
|
37
|
-
else if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
|
|
38
|
-
return await AsyncStorage.removeItem(_key);
|
|
39
|
-
}
|
|
24
|
+
removeItem: async (key: string, ..._args: Array<any>) => {
|
|
25
|
+
return StorageService.remove(key);
|
|
40
26
|
},
|
|
41
27
|
};
|
|
42
28
|
|