@bjsdistribution/dms-client-return 0.0.7 → 0.0.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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.7",
2
+ "version": "0.0.9",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
package/src/index.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { Suspense, useEffect } from 'react';
2
- import { Navigate, Route, Routes, useNavigate } from 'react-router-dom';
2
+ import { Route, Routes, useNavigate } from 'react-router-dom';
3
3
  // import AddOrder from './components/add-order';
4
4
  import OrderView from './components/order-view';
5
5
  // import AllReminder from './components/order-view/all-reminder/AllReminder';
@@ -13,6 +13,11 @@ function ReturnClient() {
13
13
  const LoadingMessage = () => <div>Loading...</div>;
14
14
  const [selectedClient] = useTableName();
15
15
  const navigate = useNavigate();
16
+ let selectedClientString = selectedClient?.replace(/\s+/g, '-');
17
+ selectedClientString = selectedClientString?.toLowerCase();
18
+
19
+ console.log(selectedClientString, 'selectedClient');
20
+ console.log(`../return/:${selectedClientString}`);
16
21
 
17
22
  useEffect(() => {
18
23
  if (!location.pathname.includes('/return')) {
@@ -24,10 +29,9 @@ function ReturnClient() {
24
29
  useEffect(() => {
25
30
  if (selectedClient) {
26
31
  const selectedClientString = selectedClient.replace(/\s+/g, '-');
27
- selectedClient;
28
- navigate(`returnclient/return/${selectedClientString}`);
32
+ navigate(`return/${selectedClientString}`);
29
33
  }
30
- }, [selectedClient, navigate]);
34
+ }, [selectedClient]);
31
35
 
32
36
  return (
33
37
  <Suspense fallback={<LoadingMessage />}>
@@ -35,20 +39,18 @@ function ReturnClient() {
35
39
  <Route path="" element={<ReturnMainTable />} />
36
40
  <Route path="order-return" element={<ReturnAfterTable />} />
37
41
  <Route path="order-return/:id" element={<OrderView />} />
38
- <Route
39
- path="returnclient/return/:selectedClient"
40
- element={<ReturnTable />}
41
- />
42
- <Route
42
+ <Route path="return/:name" element={<ReturnTable />} />
43
+
44
+ {/* <Route
43
45
  path=""
44
46
  element={
45
- selectedClient ? (
46
- <Navigate to={`returnclient/return/${selectedClient}`} />
47
+ selectedClientString ? (
48
+ <Navigate to={`return/${selectedClientString}`} />
47
49
  ) : (
48
50
  <ReturnMainTable />
49
51
  )
50
52
  }
51
- />
53
+ /> */}
52
54
  </Routes>
53
55
  </Suspense>
54
56
  );