react-redux-django-auth 1.4.4 → 1.4.5
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/index.js +9 -2
- package/dist/index.mjs +8 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -934,14 +934,19 @@ var reset_password_confirm = function(formData, apiUrl) {
|
|
|
934
934
|
};
|
|
935
935
|
var logout = function() {
|
|
936
936
|
return function(dispatch) {
|
|
937
|
+
localStorage.removeItem("access");
|
|
938
|
+
localStorage.removeItem("refresh");
|
|
939
|
+
delete import_axios.default.defaults.headers.common["Authorization"];
|
|
937
940
|
dispatch({
|
|
938
941
|
type: LOGOUT
|
|
939
942
|
});
|
|
940
943
|
};
|
|
941
944
|
};
|
|
942
945
|
var clearErrors = function() {
|
|
943
|
-
return {
|
|
944
|
-
|
|
946
|
+
return function(dispatch) {
|
|
947
|
+
dispatch({
|
|
948
|
+
type: CLEAR_ERRORS
|
|
949
|
+
});
|
|
945
950
|
};
|
|
946
951
|
};
|
|
947
952
|
var changeLoggedInUserPassword = function(formData, apiUrl) {
|
|
@@ -1965,6 +1970,7 @@ var import_toolkit = require("@reduxjs/toolkit");
|
|
|
1965
1970
|
// src/reducers/index.ts
|
|
1966
1971
|
var import_redux = require("redux");
|
|
1967
1972
|
// src/reducers/auth.ts
|
|
1973
|
+
var import_axios4 = __toESM(require("axios"));
|
|
1968
1974
|
var initialState = {
|
|
1969
1975
|
access: localStorage.getItem("access"),
|
|
1970
1976
|
refresh: localStorage.getItem("refresh"),
|
|
@@ -1986,6 +1992,7 @@ function authReducer() {
|
|
|
1986
1992
|
case FACEBOOK_AUTH_SUCCESS:
|
|
1987
1993
|
localStorage.setItem("access", payload.access);
|
|
1988
1994
|
localStorage.setItem("refresh", payload.refresh);
|
|
1995
|
+
import_axios4.default.defaults.headers.common["Authorization"] = "JWT ".concat(payload.access);
|
|
1989
1996
|
return _object_spread_props(_object_spread({}, state), {
|
|
1990
1997
|
isAuthenticated: true,
|
|
1991
1998
|
access: payload.access,
|
package/dist/index.mjs
CHANGED
|
@@ -269,14 +269,17 @@ var reset_password_confirm = (formData, apiUrl) => async (dispatch) => {
|
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
271
|
var logout = () => (dispatch) => {
|
|
272
|
+
localStorage.removeItem("access");
|
|
273
|
+
localStorage.removeItem("refresh");
|
|
274
|
+
delete axios.defaults.headers.common["Authorization"];
|
|
272
275
|
dispatch({
|
|
273
276
|
type: LOGOUT
|
|
274
277
|
});
|
|
275
278
|
};
|
|
276
|
-
var clearErrors = () => {
|
|
277
|
-
|
|
279
|
+
var clearErrors = () => (dispatch) => {
|
|
280
|
+
dispatch({
|
|
278
281
|
type: CLEAR_ERRORS
|
|
279
|
-
};
|
|
282
|
+
});
|
|
280
283
|
};
|
|
281
284
|
var changeLoggedInUserPassword = (formData, apiUrl) => async (dispatch) => {
|
|
282
285
|
if (localStorage.getItem("access")) {
|
|
@@ -786,6 +789,7 @@ import { configureStore } from "@reduxjs/toolkit";
|
|
|
786
789
|
import { combineReducers } from "redux";
|
|
787
790
|
|
|
788
791
|
// src/reducers/auth.ts
|
|
792
|
+
import axios4 from "axios";
|
|
789
793
|
var initialState = {
|
|
790
794
|
access: localStorage.getItem("access"),
|
|
791
795
|
refresh: localStorage.getItem("refresh"),
|
|
@@ -807,6 +811,7 @@ function authReducer(state = initialState, action) {
|
|
|
807
811
|
case FACEBOOK_AUTH_SUCCESS:
|
|
808
812
|
localStorage.setItem("access", payload.access);
|
|
809
813
|
localStorage.setItem("refresh", payload.refresh);
|
|
814
|
+
axios4.defaults.headers.common["Authorization"] = `JWT ${payload.access}`;
|
|
810
815
|
return {
|
|
811
816
|
...state,
|
|
812
817
|
isAuthenticated: true,
|