react-redux-django-auth 1.4.8 → 1.4.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.
@@ -4,23 +4,23 @@ export type AppDispatch = Dispatch<any>;
4
4
  /**
5
5
  * Load Authenticated User
6
6
  */
7
- export declare const load_user: (storage: AuthStorage) => (dispatch: AppDispatch) => Promise<{
7
+ export declare const load_user: () => (dispatch: AppDispatch, getState: any, storage: AuthStorage) => Promise<{
8
8
  type: string;
9
9
  } | undefined>;
10
10
  /**
11
11
  * Facebook Auth
12
12
  */
13
- export declare const facebookAuthenticate: (state: any, code: any, storage: AuthStorage) => (dispatch: AppDispatch) => Promise<void>;
13
+ export declare const facebookAuthenticate: (state: any, code: any) => (dispatch: AppDispatch, getState: any, storage: AuthStorage) => Promise<void>;
14
14
  /**
15
15
  * Check Authentication
16
16
  */
17
- export declare const checkAuthenticated: (storage: AuthStorage) => (dispatch: AppDispatch) => Promise<{
17
+ export declare const checkAuthenticated: () => (dispatch: AppDispatch, getState: any, storage: AuthStorage) => Promise<{
18
18
  type: string;
19
19
  } | undefined>;
20
20
  /**
21
21
  * Login
22
22
  */
23
- export declare const login: (formData: any, storage: AuthStorage) => (dispatch: AppDispatch) => Promise<void>;
23
+ export declare const login: (formData: any) => (dispatch: AppDispatch, getState: any, storage: AuthStorage) => Promise<void>;
24
24
  /**
25
25
  * Signup
26
26
  */
@@ -40,7 +40,7 @@ export declare const reset_password_confirm: (formData: any) => (dispatch: AppDi
40
40
  /**
41
41
  * Logout
42
42
  */
43
- export declare const logout: (storage: AuthStorage) => (dispatch: AppDispatch) => Promise<void>;
43
+ export declare const logout: () => (dispatch: AppDispatch, getState: any, storage: AuthStorage) => Promise<void>;
44
44
  /**
45
45
  * Clear Errors
46
46
  */
@@ -48,10 +48,10 @@ export declare const clearErrors: () => (dispatch: AppDispatch) => void;
48
48
  /**
49
49
  * Change Password (Authenticated)
50
50
  */
51
- export declare const changeLoggedInUserPassword: (formData: any, storage: AuthStorage) => (dispatch: AppDispatch) => Promise<{
51
+ export declare const changeLoggedInUserPassword: (formData: any) => (dispatch: AppDispatch, getState: any, storage: AuthStorage) => Promise<{
52
52
  type: string;
53
53
  } | undefined>;
54
54
  /**
55
55
  * 🔄 Refresh Access Token
56
56
  */
57
- export declare const refreshAccessToken: (storage: AuthStorage) => (dispatch: AppDispatch) => Promise<any>;
57
+ export declare const refreshAccessToken: () => (dispatch: AppDispatch, getState: any, storage: AuthStorage) => Promise<any>;
@@ -61,8 +61,8 @@ var getAuthConfig = function (storage) { return __awaiter(void 0, void 0, void 0
61
61
  /**
62
62
  * Load Authenticated User
63
63
  */
64
- export var load_user = function (storage) {
65
- return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
64
+ export var load_user = function () {
65
+ return function (dispatch, getState, storage) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var config, res, _a;
67
67
  return __generator(this, function (_b) {
68
68
  switch (_b.label) {
@@ -95,7 +95,7 @@ export var load_user = function (storage) {
95
95
  /**
96
96
  * Facebook Auth
97
97
  */
98
- export var facebookAuthenticate = function (state, code, storage) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
98
+ export var facebookAuthenticate = function (state, code) { return function (dispatch, getState, storage) { return __awaiter(void 0, void 0, void 0, function () {
99
99
  var token, res, _a, access, refresh, err_1;
100
100
  var _b;
101
101
  return __generator(this, function (_c) {
@@ -122,7 +122,7 @@ export var facebookAuthenticate = function (state, code, storage) { return funct
122
122
  type: FACEBOOK_AUTH_SUCCESS,
123
123
  payload: res.data
124
124
  });
125
- dispatch(load_user(storage));
125
+ dispatch(load_user());
126
126
  return [3 /*break*/, 6];
127
127
  case 5:
128
128
  err_1 = _c.sent();
@@ -138,8 +138,8 @@ export var facebookAuthenticate = function (state, code, storage) { return funct
138
138
  /**
139
139
  * Check Authentication
140
140
  */
141
- export var checkAuthenticated = function (storage) {
142
- return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
141
+ export var checkAuthenticated = function () {
142
+ return function (dispatch, getState, storage) { return __awaiter(void 0, void 0, void 0, function () {
143
143
  var token, res, _a;
144
144
  return __generator(this, function (_b) {
145
145
  switch (_b.label) {
@@ -173,7 +173,7 @@ export var checkAuthenticated = function (storage) {
173
173
  /**
174
174
  * Login
175
175
  */
176
- export var login = function (formData, storage) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
176
+ export var login = function (formData) { return function (dispatch, getState, storage) { return __awaiter(void 0, void 0, void 0, function () {
177
177
  var res, _a, access, refresh, err_2;
178
178
  var _b;
179
179
  return __generator(this, function (_c) {
@@ -195,7 +195,7 @@ export var login = function (formData, storage) { return function (dispatch) { r
195
195
  status: res.status
196
196
  }
197
197
  });
198
- dispatch(load_user(storage));
198
+ dispatch(load_user());
199
199
  return [3 /*break*/, 4];
200
200
  case 3:
201
201
  err_2 = _c.sent();
@@ -339,8 +339,8 @@ export var reset_password_confirm = function (formData) {
339
339
  /**
340
340
  * Logout
341
341
  */
342
- export var logout = function (storage) {
343
- return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
342
+ export var logout = function () {
343
+ return function (dispatch, getState, storage) { return __awaiter(void 0, void 0, void 0, function () {
344
344
  return __generator(this, function (_a) {
345
345
  switch (_a.label) {
346
346
  case 0: return [4 /*yield*/, storage.clearTokens()];
@@ -361,7 +361,7 @@ export var clearErrors = function () { return function (dispatch) {
361
361
  /**
362
362
  * Change Password (Authenticated)
363
363
  */
364
- export var changeLoggedInUserPassword = function (formData, storage) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
364
+ export var changeLoggedInUserPassword = function (formData) { return function (dispatch, getState, storage) { return __awaiter(void 0, void 0, void 0, function () {
365
365
  var config, res, err_7;
366
366
  var _a;
367
367
  return __generator(this, function (_b) {
@@ -397,7 +397,7 @@ export var changeLoggedInUserPassword = function (formData, storage) { return fu
397
397
  /**
398
398
  * 🔄 Refresh Access Token
399
399
  */
400
- export var refreshAccessToken = function (storage) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
400
+ export var refreshAccessToken = function () { return function (dispatch, getState, storage) { return __awaiter(void 0, void 0, void 0, function () {
401
401
  var refresh, res, access, err_8;
402
402
  var _a;
403
403
  return __generator(this, function (_b) {
@@ -432,7 +432,7 @@ export var refreshAccessToken = function (storage) { return function (dispatch)
432
432
  }
433
433
  });
434
434
  // 🔄 Reload user after refresh
435
- dispatch(load_user(storage));
435
+ dispatch(load_user());
436
436
  return [2 /*return*/, access];
437
437
  case 6:
438
438
  err_8 = _b.sent();
@@ -1,4 +1,3 @@
1
- import { AuthStorage } from "../actions/types";
2
1
  interface FormData {
3
2
  current_password?: string;
4
3
  new_password?: string;
@@ -12,5 +11,5 @@ interface ChangePasswordHookReturn {
12
11
  onSubmit: (e: React.FormEvent) => Promise<void>;
13
12
  status: any;
14
13
  }
15
- declare const useChangeAuthenticatedUserPassword: (initialFields: FormData, storage: AuthStorage) => ChangePasswordHookReturn;
14
+ declare const useChangeAuthenticatedUserPassword: (initialFields: FormData) => ChangePasswordHookReturn;
16
15
  export default useChangeAuthenticatedUserPassword;
@@ -49,7 +49,7 @@ import { useState, useCallback, useEffect } from "react";
49
49
  import { useDispatch, useSelector } from "react-redux";
50
50
  import { changeLoggedInUserPassword, clearErrors, } from "../actions/authActions";
51
51
  // The custom hook is now typed with its parameters and return value
52
- var useChangeAuthenticatedUserPassword = function (initialFields, storage) {
52
+ var useChangeAuthenticatedUserPassword = function (initialFields) {
53
53
  // useDispatch is typed with our custom AppDispatch
54
54
  var dispatch = useDispatch();
55
55
  // useState is typed as boolean, FormData, and string | null
@@ -93,7 +93,11 @@ var useChangeAuthenticatedUserPassword = function (initialFields, storage) {
93
93
  case 1:
94
94
  _a.trys.push([1, 3, 4, 5]);
95
95
  // The dispatch call is type-safe
96
- return [4 /*yield*/, dispatch(changeLoggedInUserPassword({ current_password: current_password, new_password: new_password, re_new_password: re_new_password }, storage))];
96
+ return [4 /*yield*/, dispatch(changeLoggedInUserPassword({
97
+ current_password: current_password,
98
+ new_password: new_password,
99
+ re_new_password: re_new_password,
100
+ }))];
97
101
  case 2:
98
102
  // The dispatch call is type-safe
99
103
  _a.sent();
@@ -1,4 +1,3 @@
1
- import { AuthStorage } from "../actions/types";
2
1
  interface FacebookAuthHookReturn {
3
2
  continueWithFacebook: () => Promise<void>;
4
3
  authenticateWithFacebook: (state: string, code: string) => Promise<void>;
@@ -7,5 +6,5 @@ interface FacebookAuthHookReturn {
7
6
  isStatus201: boolean;
8
7
  loading: boolean;
9
8
  }
10
- declare const useFacebookAuth: (storage: AuthStorage) => FacebookAuthHookReturn;
9
+ declare const useFacebookAuth: () => FacebookAuthHookReturn;
11
10
  export default useFacebookAuth;
@@ -40,7 +40,7 @@ import { facebookAuthenticate, clearErrors } from "../actions/authActions";
40
40
  import axios from "axios";
41
41
  import { getBaseURL } from "../apis/config";
42
42
  // The custom hook is now typed with its parameters and return value
43
- var useFacebookAuth = function (storage) {
43
+ var useFacebookAuth = function () {
44
44
  // useDispatch is typed with our custom AppDispatch
45
45
  var dispatch = useDispatch();
46
46
  // useSelector is typed with AuthState for type-safe state access
@@ -77,7 +77,7 @@ var useFacebookAuth = function (storage) {
77
77
  case 5: return [2 /*return*/];
78
78
  }
79
79
  });
80
- }); }, [dispatch, storage]);
80
+ }); }, [dispatch]);
81
81
  // Authenticate with Facebook after redirection
82
82
  var authenticateWithFacebook = useCallback(function (state, code) { return __awaiter(void 0, void 0, void 0, function () {
83
83
  var err_2;
@@ -90,7 +90,7 @@ var useFacebookAuth = function (storage) {
90
90
  _a.label = 1;
91
91
  case 1:
92
92
  _a.trys.push([1, 3, 4, 5]);
93
- return [4 /*yield*/, dispatch(facebookAuthenticate(state, code, storage))];
93
+ return [4 /*yield*/, dispatch(facebookAuthenticate(state, code))];
94
94
  case 2:
95
95
  _a.sent();
96
96
  return [3 /*break*/, 5];
@@ -104,7 +104,7 @@ var useFacebookAuth = function (storage) {
104
104
  case 5: return [2 /*return*/];
105
105
  }
106
106
  });
107
- }); }, [dispatch, storage]);
107
+ }); }, [dispatch]);
108
108
  // Clear errors when the hook is unmounted
109
109
  useEffect(function () {
110
110
  // Clear errors when the component mounts
@@ -1,4 +1,3 @@
1
- import { AuthStorage } from "../actions/types";
2
1
  interface AuthHookReturn {
3
2
  error: any;
4
3
  isAuthenticated: boolean | null;
@@ -8,5 +7,5 @@ interface AuthHookReturn {
8
7
  refreshAuth: () => Promise<void>;
9
8
  isLoading: boolean;
10
9
  }
11
- declare const useAuthicatedUser: (location: any, storage: AuthStorage) => AuthHookReturn;
10
+ declare const useAuthicatedUser: (location: any) => AuthHookReturn;
12
11
  export default useAuthicatedUser;
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  import { useCallback, useEffect, useState } from "react";
38
38
  import { useDispatch, useSelector } from "react-redux";
39
39
  import { checkAuthenticated, load_user, clearErrors, } from "../actions/authActions";
40
- var useAuthicatedUser = function (location, storage) {
40
+ var useAuthicatedUser = function (location) {
41
41
  var dispatch = useDispatch();
42
42
  // Use separate loading states for each async action
43
43
  var _a = useState(true), isAuthLoading = _a[0], setIsAuthLoading = _a[1];
@@ -52,7 +52,7 @@ var useAuthicatedUser = function (location, storage) {
52
52
  switch (_a.label) {
53
53
  case 0:
54
54
  setIsAuthLoading(true);
55
- return [4 /*yield*/, dispatch(checkAuthenticated(storage))];
55
+ return [4 /*yield*/, dispatch(checkAuthenticated())];
56
56
  case 1:
57
57
  _a.sent();
58
58
  setIsAuthLoading(false);
@@ -61,7 +61,7 @@ var useAuthicatedUser = function (location, storage) {
61
61
  });
62
62
  }); };
63
63
  runAuthCheck();
64
- }, [dispatch, location, storage]);
64
+ }, [dispatch, location]);
65
65
  // 2️⃣ Whenever isAuthenticated flips true: load the user profile
66
66
  useEffect(function () {
67
67
  if (isAuthenticated) {
@@ -70,7 +70,7 @@ var useAuthicatedUser = function (location, storage) {
70
70
  switch (_a.label) {
71
71
  case 0:
72
72
  setIsUserLoading(true);
73
- return [4 /*yield*/, dispatch(load_user(storage))];
73
+ return [4 /*yield*/, dispatch(load_user())];
74
74
  case 1:
75
75
  _a.sent();
76
76
  setIsUserLoading(false);
@@ -80,23 +80,23 @@ var useAuthicatedUser = function (location, storage) {
80
80
  }); };
81
81
  runUserLoad();
82
82
  }
83
- }, [dispatch, isAuthenticated, storage]);
83
+ }, [dispatch, isAuthenticated]);
84
84
  // Expose a manual “refresh user” function
85
85
  var refreshUser = useCallback(function () {
86
- dispatch(load_user(storage));
87
- }, [dispatch, storage]);
86
+ dispatch(load_user());
87
+ }, [dispatch]);
88
88
  // Expose a manual “re-auth + reload” function
89
89
  var refreshAuth = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
90
90
  return __generator(this, function (_a) {
91
91
  switch (_a.label) {
92
- case 0: return [4 /*yield*/, dispatch(checkAuthenticated(storage))];
92
+ case 0: return [4 /*yield*/, dispatch(checkAuthenticated())];
93
93
  case 1:
94
94
  _a.sent();
95
- dispatch(load_user(storage));
95
+ dispatch(load_user());
96
96
  return [2 /*return*/];
97
97
  }
98
98
  });
99
- }); }, [dispatch, storage]);
99
+ }); }, [dispatch]);
100
100
  // Wrap clearErrors so consumer can wipe errors
101
101
  var clearErrorsWrapper = useCallback(function () {
102
102
  dispatch(clearErrors());
@@ -1,4 +1,3 @@
1
- import { AuthStorage } from "../actions/types";
2
1
  interface LoginHookReturn {
3
2
  loading: boolean;
4
3
  formData: any;
@@ -9,5 +8,5 @@ interface LoginHookReturn {
9
8
  isAuthenticated: boolean | null;
10
9
  isStatus200: boolean;
11
10
  }
12
- declare const useLogin: (initialFields: any, location: any, storage: AuthStorage) => LoginHookReturn;
11
+ declare const useLogin: (initialFields: any, location: any) => LoginHookReturn;
13
12
  export default useLogin;
@@ -49,7 +49,7 @@ import { useState, useCallback, useEffect } from "react";
49
49
  import { useDispatch, useSelector } from "react-redux";
50
50
  import { login, clearErrors } from "../actions/authActions";
51
51
  // The custom hook is now typed with its parameters and return value
52
- var useLogin = function (initialFields, location, storage) {
52
+ var useLogin = function (initialFields, location) {
53
53
  var _a = useState(false), loading = _a[0], setLoading = _a[1];
54
54
  var _b = useState(initialFields), formData = _b[0], setFormData = _b[1];
55
55
  // useDispatch is typed with our custom AppDispatch
@@ -88,7 +88,7 @@ var useLogin = function (initialFields, location, storage) {
88
88
  case 1:
89
89
  _a.trys.push([1, 3, 4, 5]);
90
90
  // The dispatch call is type-safe
91
- return [4 /*yield*/, dispatch(login(formData, storage))];
91
+ return [4 /*yield*/, dispatch(login(formData))];
92
92
  case 2:
93
93
  // The dispatch call is type-safe
94
94
  _a.sent();
@@ -104,7 +104,7 @@ var useLogin = function (initialFields, location, storage) {
104
104
  case 5: return [2 /*return*/];
105
105
  }
106
106
  });
107
- }); }, [dispatch, formData, storage]);
107
+ }); }, [dispatch, formData]);
108
108
  return {
109
109
  loading: loading,
110
110
  formData: formData,
@@ -1,3 +1,2 @@
1
- import { AuthStorage } from "../actions/types";
2
- declare const useLogout: (storage: AuthStorage) => (() => void);
1
+ declare const useLogout: () => (() => void);
3
2
  export default useLogout;
@@ -2,12 +2,12 @@ import { useCallback } from "react";
2
2
  import { useDispatch } from "react-redux";
3
3
  import { logout } from "../actions/authActions";
4
4
  // The custom hook is now typed with its return value
5
- var useLogout = function (storage) {
5
+ var useLogout = function () {
6
6
  // useDispatch is typed with our custom AppDispatch
7
7
  var dispatch = useDispatch();
8
8
  // The handleLogout function is memoized and typed
9
9
  var handleLogout = useCallback(function () {
10
- dispatch(logout(storage));
10
+ dispatch(logout());
11
11
  }, [dispatch]);
12
12
  return handleLogout;
13
13
  };
@@ -66,7 +66,7 @@ var useBiometricAuth = function (_a) {
66
66
  access = _a.sent();
67
67
  if (access)
68
68
  return [2 /*return*/, access];
69
- return [4 /*yield*/, dispatch(refreshAccessToken(storage))];
69
+ return [4 /*yield*/, dispatch(refreshAccessToken())];
70
70
  case 5:
71
71
  newAccess = _a.sent();
72
72
  if (!newAccess)
@@ -3,6 +3,12 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
3
3
  }, any, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
4
4
  dispatch: import("redux-thunk").ThunkDispatch<{
5
5
  auth: import("../auth-core/reducers/authReducer").AuthState;
6
- }, undefined, import("redux").UnknownAction>;
6
+ }, {
7
+ getAccessToken: () => Promise<string | null>;
8
+ getRefreshToken: () => Promise<string | null>;
9
+ setTokens: (access: string, refresh?: string) => Promise<void>;
10
+ clearTokens: () => Promise<void>;
11
+ }, import("redux").UnknownAction>;
7
12
  }>, import("redux").StoreEnhancer]>>;
13
+ export type AppDispatch = typeof store.dispatch;
8
14
  export default store;
@@ -1,9 +1,19 @@
1
1
  import { configureStore } from '@reduxjs/toolkit';
2
2
  import rootReducer from '../auth-core/reducers';
3
+ // 1. Import your storage (ensure you have storage.ts and storage.native.ts)
4
+ import { storage } from './storage/nativeStorage';
3
5
  var initialState = {};
4
6
  var store = configureStore({
5
7
  reducer: rootReducer,
6
- // If you want to set an initial state, use preloadedState instead:
7
8
  preloadedState: initialState,
9
+ // 2. This is the "Magic" part
10
+ middleware: function (getDefaultMiddleware) {
11
+ return getDefaultMiddleware({
12
+ thunk: {
13
+ extraArgument: storage, // 💉 Inject the "Fuel Tank" here
14
+ },
15
+ serializableCheck: false, // Recommended when passing storage objects
16
+ });
17
+ },
8
18
  });
9
19
  export default store;
@@ -1,4 +1,3 @@
1
- import { AuthStorage } from "../../auth-core/actions/types";
2
1
  interface GoogleAuthHookReturn {
3
2
  continueWithGoogle: () => Promise<void>;
4
3
  authenticateWithGoogle: (state: string, code: string) => Promise<void>;
@@ -7,5 +6,5 @@ interface GoogleAuthHookReturn {
7
6
  isStatus201: boolean;
8
7
  loading: boolean;
9
8
  }
10
- declare const useGoogleAuth: (storage: AuthStorage) => GoogleAuthHookReturn;
9
+ declare const useGoogleAuth: () => GoogleAuthHookReturn;
11
10
  export default useGoogleAuth;
@@ -41,7 +41,7 @@ import axios from "axios";
41
41
  import { googleAuthenticate } from "../oauth/google";
42
42
  import { getBaseURL } from "../../auth-core/apis/config";
43
43
  // The custom hook is now typed with its parameters and return value
44
- var useGoogleAuth = function (storage) {
44
+ var useGoogleAuth = function () {
45
45
  // useDispatch is typed with our custom AppDispatch
46
46
  var dispatch = useDispatch();
47
47
  // useSelector is typed with AuthState for type-safe state access
@@ -91,7 +91,7 @@ var useGoogleAuth = function (storage) {
91
91
  _a.label = 1;
92
92
  case 1:
93
93
  _a.trys.push([1, 3, 4, 5]);
94
- return [4 /*yield*/, dispatch(googleAuthenticate(state, code, storage))];
94
+ return [4 /*yield*/, dispatch(googleAuthenticate(state, code))];
95
95
  case 2:
96
96
  _a.sent();
97
97
  return [3 /*break*/, 5];
@@ -105,7 +105,7 @@ var useGoogleAuth = function (storage) {
105
105
  case 5: return [2 /*return*/];
106
106
  }
107
107
  });
108
- }); }, [dispatch, storage]);
108
+ }); }, [dispatch]);
109
109
  // Clear errors when the hook is unmounted
110
110
  useEffect(function () {
111
111
  // Clear errors when the component mounts
@@ -1,3 +1,3 @@
1
1
  import { AppDispatch } from '../../auth-core/actions/authActions';
2
2
  import { AuthStorage } from '../../auth-core/actions/types';
3
- export declare const googleAuthenticate: (state: any, code: any, storage: AuthStorage) => (dispatch: AppDispatch) => Promise<void>;
3
+ export declare const googleAuthenticate: (state: any, code: any) => (dispatch: AppDispatch, getState: any, storage: AuthStorage) => Promise<void>;
@@ -49,7 +49,7 @@ import axios from 'axios';
49
49
  import { load_user } from '../../auth-core/actions/authActions';
50
50
  import { GOOGLE_AUTH_FAIL, GOOGLE_AUTH_SUCCESS, } from '../../auth-core/actions/types';
51
51
  import { getBaseURL } from '../../auth-core/apis/config';
52
- export var googleAuthenticate = function (state, code, storage) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
52
+ export var googleAuthenticate = function (state, code) { return function (dispatch, getState, storage) { return __awaiter(void 0, void 0, void 0, function () {
53
53
  var config, details_1, formBody, res, err_1, error;
54
54
  return __generator(this, function (_a) {
55
55
  switch (_a.label) {
@@ -75,7 +75,7 @@ export var googleAuthenticate = function (state, code, storage) { return functio
75
75
  type: GOOGLE_AUTH_SUCCESS,
76
76
  payload: __assign(__assign({}, res.data), { status: res.status })
77
77
  });
78
- dispatch(load_user(storage));
78
+ dispatch(load_user());
79
79
  return [3 /*break*/, 4];
80
80
  case 3:
81
81
  err_1 = _a.sent();
@@ -3,6 +3,11 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
3
3
  }, any, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
4
4
  dispatch: import("redux-thunk").ThunkDispatch<{
5
5
  auth: import("../auth-core/reducers/authReducer").AuthState;
6
- }, undefined, import("redux").UnknownAction>;
6
+ }, {
7
+ getAccessToken: () => string | null;
8
+ setTokens: (access: string, refresh?: string) => void;
9
+ clearTokens: () => void;
10
+ }, import("redux").UnknownAction>;
7
11
  }>, import("redux").StoreEnhancer]>>;
12
+ export type AppDispatch = typeof store.dispatch;
8
13
  export default store;
@@ -1,9 +1,18 @@
1
1
  import { configureStore } from '@reduxjs/toolkit';
2
2
  import rootReducer from '../auth-core/reducers';
3
+ import { storage } from './storage/webStorage';
3
4
  var initialState = {};
4
5
  var store = configureStore({
5
6
  reducer: rootReducer,
6
- // If you want to set an initial state, use preloadedState instead:
7
7
  preloadedState: initialState,
8
+ // 2. This is the "Magic" part
9
+ middleware: function (getDefaultMiddleware) {
10
+ return getDefaultMiddleware({
11
+ thunk: {
12
+ extraArgument: storage, // 💉 Inject the "Fuel Tank" here
13
+ },
14
+ serializableCheck: false, // Recommended when passing storage objects
15
+ });
16
+ },
8
17
  });
9
18
  export default store;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-redux-django-auth",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "description": "A React Redux Authentication system for django app built with TypeScript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",