react-redux-django-auth 1.4.7 → 1.4.8

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.
@@ -3,8 +3,5 @@ export var setBaseURL = function (url) {
3
3
  BASE_URL = url;
4
4
  };
5
5
  export var getBaseURL = function () {
6
- if (!BASE_URL) {
7
- throw new Error("API URL not set. Wrap app with AuthProvider.");
8
- }
9
6
  return BASE_URL;
10
7
  };
@@ -60,7 +60,8 @@ import { getBaseURL } from "../apis/config";
60
60
  export var setupAuth = function (storage) {
61
61
  var isRefreshing = false;
62
62
  var failedQueue = [];
63
- var api = createApi(getBaseURL());
63
+ // 1. Declare the variable but don't initialize it yet
64
+ var api;
64
65
  var processQueue = function (error, token) {
65
66
  if (token === void 0) { token = null; }
66
67
  failedQueue.forEach(function (prom) {
@@ -69,6 +70,9 @@ export var setupAuth = function (storage) {
69
70
  failedQueue = [];
70
71
  };
71
72
  var initialize = function () {
73
+ // 2. Initialize the API here!
74
+ // This only runs when the user calls auth.initialize() in their App/Layout.
75
+ api = createApi(getBaseURL());
72
76
  api.interceptors.request.use(function (config) { return __awaiter(void 0, void 0, void 0, function () {
73
77
  var token;
74
78
  return __generator(this, function (_a) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-redux-django-auth",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
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",