mario-core 2.6.9 → 2.7.0

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.
@@ -11,7 +11,7 @@ declare type UserDetail = {
11
11
  };
12
12
  declare const useUserDetail: (id?: string | undefined) => {
13
13
  userDetail: UserDetail;
14
- backToList: () => void;
14
+ backToList: (user?: string | undefined) => void;
15
15
  confirmData: (data: any) => Promise<void>;
16
16
  file: any;
17
17
  setFile: import("react").Dispatch<any>;
@@ -2,6 +2,7 @@ declare const useUserList: () => {
2
2
  userList: any;
3
3
  totalItems: any;
4
4
  filters: import("../../..").Filter;
5
+ fullName: string | null;
5
6
  getData: () => Promise<void>;
6
7
  removeData: (id: string) => void;
7
8
  changeFilters: (updatedFilters: any) => void;
package/dist/index.js CHANGED
@@ -4079,6 +4079,8 @@ var TITLE$8 = "User list";
4079
4079
 
4080
4080
  var useUserList = function useUserList() {
4081
4081
  var history = reactRouterDom.useHistory();
4082
+ var query = new URLSearchParams(location.search);
4083
+ var fullName = query.get("query");
4082
4084
  var userList = reactRedux.useSelector(function (state) {
4083
4085
  return state.users.userList;
4084
4086
  });
@@ -4129,6 +4131,11 @@ var useUserList = function useUserList() {
4129
4131
  React.useEffect(function () {
4130
4132
  getData();
4131
4133
  }, [filters]);
4134
+ React.useEffect(function () {
4135
+ changeFilters({
4136
+ searchString: fullName
4137
+ });
4138
+ }, [fullName]);
4132
4139
  var removeData = React.useCallback(function (id) {
4133
4140
  dispatch(setLoading(true));
4134
4141
 
@@ -4174,6 +4181,7 @@ var useUserList = function useUserList() {
4174
4181
  userList: userList,
4175
4182
  totalItems: totalItems,
4176
4183
  filters: filters,
4184
+ fullName: fullName,
4177
4185
  getData: getData,
4178
4186
  removeData: removeData,
4179
4187
  changeFilters: changeFilters,
@@ -4250,6 +4258,7 @@ var header$2 = "User";
4250
4258
 
4251
4259
  var UserList = function UserList() {
4252
4260
  var _useUserList = useUserList(),
4261
+ fullName = _useUserList.fullName,
4253
4262
  userList = _useUserList.userList,
4254
4263
  totalItems = _useUserList.totalItems,
4255
4264
  filters = _useUserList.filters,
@@ -4270,7 +4279,7 @@ var UserList = function UserList() {
4270
4279
  onClick: function onClick() {
4271
4280
  return reDirectDetailPage();
4272
4281
  },
4273
- initValue: "",
4282
+ initValue: !!fullName ? fullName : '',
4274
4283
  onSearch: function onSearch(searchString) {
4275
4284
  return changeFilters({
4276
4285
  searchString: searchString
@@ -4509,8 +4518,8 @@ var useUserDetail = function useUserDetail(id) {
4509
4518
  return Promise.reject(e);
4510
4519
  }
4511
4520
  }, [id]);
4512
- var backToList = React.useCallback(function () {
4513
- history.push(USER_LIST_URL);
4521
+ var backToList = React.useCallback(function (user) {
4522
+ !!user ? history.push(USER_LIST_URL + ("?query=" + user)) : history.push(USER_LIST_URL);
4514
4523
  }, []);
4515
4524
  var confirmData = React.useCallback(function (data) {
4516
4525
  try {
@@ -4524,12 +4533,17 @@ var useUserDetail = function useUserDetail(id) {
4524
4533
  function _temp6() {
4525
4534
  var next = !!id ? update$3 : create$3;
4526
4535
  !id && delete data.id;
4527
- return Promise.resolve(next(data)).then(function () {
4536
+ return Promise.resolve(next(data)).then(function (result) {
4537
+ if (!!result) {
4538
+ getById$3(result.data.id).then(function (e) {
4539
+ backToList(e.data.fullName);
4540
+ });
4541
+ }
4542
+
4528
4543
  dispatch(setAlert({
4529
4544
  type: "success",
4530
4545
  message: (!!id ? "Update" : "Create") + " user successfully"
4531
4546
  }));
4532
- backToList();
4533
4547
  });
4534
4548
  }
4535
4549