react-redux-django-auth 1.3.3 → 1.3.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.d.mts CHANGED
@@ -13,6 +13,7 @@ interface LoginHookReturn {
13
13
  loading: boolean;
14
14
  formData: any;
15
15
  error: any;
16
+ currentUser: any;
16
17
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
17
18
  onSubmit: (e: React.FormEvent) => Promise<void>;
18
19
  isAuthenticated: boolean | null;
@@ -75,7 +76,7 @@ declare const usePasswordConfirm: (initialFields: FormData$1, apiUrl: string) =>
75
76
  interface FormData {
76
77
  current_password?: string;
77
78
  new_password?: string;
78
- confirm_new_password?: string;
79
+ re_new_password?: string;
79
80
  }
80
81
  interface ChangePasswordHookReturn {
81
82
  loading: boolean;
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ interface LoginHookReturn {
13
13
  loading: boolean;
14
14
  formData: any;
15
15
  error: any;
16
+ currentUser: any;
16
17
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
17
18
  onSubmit: (e: React.FormEvent) => Promise<void>;
18
19
  isAuthenticated: boolean | null;
@@ -75,7 +76,7 @@ declare const usePasswordConfirm: (initialFields: FormData$1, apiUrl: string) =>
75
76
  interface FormData {
76
77
  current_password?: string;
77
78
  new_password?: string;
78
- confirm_new_password?: string;
79
+ re_new_password?: string;
79
80
  }
80
81
  interface ChangePasswordHookReturn {
81
82
  loading: boolean;
package/dist/index.js CHANGED
@@ -1111,6 +1111,9 @@ var useLogin = function(initialFields, apiUrl) {
1111
1111
  var status = (0, import_react_redux2.useSelector)(function(state) {
1112
1112
  return state.auth.status;
1113
1113
  });
1114
+ var currentUser = (0, import_react_redux2.useSelector)(function(state) {
1115
+ return state.auth.user;
1116
+ });
1114
1117
  var isStatus200 = status === 200;
1115
1118
  (0, import_react2.useEffect)(function() {
1116
1119
  return function() {
@@ -1182,7 +1185,8 @@ var useLogin = function(initialFields, apiUrl) {
1182
1185
  onChange: handleChange,
1183
1186
  onSubmit: handleSubmit,
1184
1187
  isAuthenticated: isAuthenticated,
1185
- isStatus200: isStatus200
1188
+ isStatus200: isStatus200,
1189
+ currentUser: currentUser
1186
1190
  };
1187
1191
  };
1188
1192
  var useLogin_default = useLogin;
@@ -1566,13 +1570,13 @@ var useChangeAuthenticatedUserPassword = function(initialFields, apiUrl) {
1566
1570
  }, []);
1567
1571
  var handleSubmit = (0, import_react8.useCallback)(function(e) {
1568
1572
  return _async_to_generator(function() {
1569
- var current_password, new_password, confirm_new_password, err;
1573
+ var current_password, new_password, re_new_password, err;
1570
1574
  return _ts_generator(this, function(_state) {
1571
1575
  switch(_state.label){
1572
1576
  case 0:
1573
1577
  e.preventDefault();
1574
- current_password = formData.current_password, new_password = formData.new_password, confirm_new_password = formData.confirm_new_password;
1575
- if (new_password !== confirm_new_password) {
1578
+ current_password = formData.current_password, new_password = formData.new_password, re_new_password = formData.re_new_password;
1579
+ if (new_password !== re_new_password) {
1576
1580
  setError("New passwords do not match.");
1577
1581
  return [
1578
1582
  2
package/dist/index.mjs CHANGED
@@ -358,6 +358,7 @@ var useLogin = (initialFields, apiUrl) => {
358
358
  );
359
359
  const error = useSelector2((state) => state.auth.error);
360
360
  const status = useSelector2((state) => state.auth.status);
361
+ const currentUser = useSelector2((state) => state.auth.user);
361
362
  const isStatus200 = status === 200;
362
363
  useEffect2(() => {
363
364
  return () => {
@@ -389,7 +390,8 @@ var useLogin = (initialFields, apiUrl) => {
389
390
  onChange: handleChange,
390
391
  onSubmit: handleSubmit,
391
392
  isAuthenticated,
392
- isStatus200
393
+ isStatus200,
394
+ currentUser
393
395
  };
394
396
  };
395
397
  var useLogin_default = useLogin;
@@ -605,8 +607,8 @@ var useChangeAuthenticatedUserPassword = (initialFields, apiUrl) => {
605
607
  const handleSubmit = useCallback8(
606
608
  async (e) => {
607
609
  e.preventDefault();
608
- const { current_password, new_password, confirm_new_password } = formData;
609
- if (new_password !== confirm_new_password) {
610
+ const { current_password, new_password, re_new_password } = formData;
611
+ if (new_password !== re_new_password) {
610
612
  setError("New passwords do not match.");
611
613
  return;
612
614
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-redux-django-auth",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
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",