pocketbase-react 0.1.20 → 0.1.21

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.
Files changed (41) hide show
  1. package/dist/pocketbase-react.js +194 -290
  2. package/dist/pocketbase-react.min.js +3 -3
  3. package/es/context/Pocketbase.js +18 -3
  4. package/es/context/auth.js +0 -17
  5. package/es/hooks/useAppContent.js +3 -4
  6. package/es/store/actions/index.d.ts +1 -2
  7. package/es/store/actions/index.js +1 -2
  8. package/es/store/reducers/index.d.ts +3 -8
  9. package/es/store/reducers/index.js +2 -4
  10. package/es/store/reducers/subscriptions.d.ts +1 -4
  11. package/es/store/reducers/subscriptions.js +5 -14
  12. package/es/store/store.d.ts +3 -4
  13. package/es/store/types/index.d.ts +0 -7
  14. package/es/store/types/index.js +1 -7
  15. package/lib/context/Pocketbase.js +17 -2
  16. package/lib/context/auth.js +0 -17
  17. package/lib/hooks/useAppContent.js +3 -6
  18. package/lib/store/actions/index.js +1 -3
  19. package/lib/store/reducers/index.js +1 -3
  20. package/lib/store/reducers/subscriptions.js +5 -14
  21. package/lib/store/types/index.js +2 -14
  22. package/package.json +1 -1
  23. package/src/context/Pocketbase.tsx +16 -5
  24. package/src/context/auth.tsx +1 -23
  25. package/src/hooks/useAppContent.ts +3 -3
  26. package/src/store/actions/index.tsx +1 -2
  27. package/src/store/reducers/index.tsx +3 -9
  28. package/src/store/reducers/subscriptions.tsx +6 -23
  29. package/src/store/types/index.ts +0 -15
  30. package/es/service/Authentication.d.ts +0 -23
  31. package/es/service/Authentication.js +0 -32
  32. package/es/store/actions/auth.d.ts +0 -9
  33. package/es/store/actions/auth.js +0 -26
  34. package/es/store/reducers/auth.d.ts +0 -12
  35. package/es/store/reducers/auth.js +0 -36
  36. package/lib/service/Authentication.js +0 -37
  37. package/lib/store/actions/auth.js +0 -37
  38. package/lib/store/reducers/auth.js +0 -44
  39. package/src/service/Authentication.ts +0 -40
  40. package/src/store/actions/auth.tsx +0 -41
  41. package/src/store/reducers/auth.tsx +0 -57
@@ -1,57 +0,0 @@
1
- import { Admin, User } from '@tobicrain/pocketbase';
2
- import * as ReduxType from '../types';
3
-
4
- export interface ReduxAuth {
5
- token: string;
6
- model: User | Admin | null;
7
- cookie: string | null;
8
- }
9
-
10
- export type AuthAction = {
11
- type: ReduxType.AuthTypes;
12
- payload: User | Admin | null | string;
13
- };
14
-
15
- export const auth = (
16
- state: ReduxAuth = {
17
- model: null,
18
- token: '',
19
- cookie: null,
20
- },
21
- action: AuthAction
22
- ) => {
23
- switch (action.type) {
24
- case ReduxType.SET_TOKEN:
25
- return {
26
- ...state,
27
- token: action.payload as string,
28
- };
29
- case ReduxType.SET_MODEL:
30
- return {
31
- ...state,
32
- model: action.payload as User | Admin | null,
33
- };
34
- case ReduxType.SET_COOKIE:
35
- return {
36
- ...state,
37
- cookie: action.payload as string,
38
- };
39
- case ReduxType.DELETE_TOKEN:
40
- return {
41
- ...state,
42
- token: '',
43
- };
44
- case ReduxType.DELETE_MODEL:
45
- return {
46
- ...state,
47
- model: null,
48
- };
49
- case ReduxType.DELETE_COOKIE:
50
- return {
51
- ...state,
52
- cookie: null,
53
- };
54
- default:
55
- return state;
56
- }
57
- };