OSDN Git Service

fit the normal transactions into the tutorial mode.
[bytom/bytom-electron.git] / src / features / shared / routes.js
index d71f9d0..b18aad9 100644 (file)
@@ -1,10 +1,22 @@
 import { RoutingContainer } from 'features/shared/components'
 import { humanize } from 'utility/string'
+import { UTXOpageSize, pageSize } from 'utility/environment'
 import actions from 'actions'
 
 const makeRoutes = (store, type, List, New, Show, options = {}) => {
-  const loadPage = () => {
-    store.dispatch(actions[type].fetchAll())
+  const loadPage = ( state ) => {
+    if(type === 'transaction' || type === 'unspent'){
+      const query = state.location.query
+      const pageNumber = parseInt(state.location.query.page || 1)
+      const pageSizes = (type === 'unspent')? UTXOpageSize: pageSize
+      if (pageNumber == 1) {
+        store.dispatch(actions[type].fetchPage(query, pageNumber, { refresh: true, pageSize: pageSizes }))
+      } else {
+        store.dispatch(actions[type].fetchPage(query, pageNumber,  { pageSize: pageSizes }))
+      }
+    }else{
+      store.dispatch(actions[type].fetchAll())
+    }
   }
 
   const childRoutes = []