Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
warehouse-management
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
warehouse-management
Commits
bda5bf1b
Commit
bda5bf1b
authored
May 05, 2021
by
Darrick Yong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix getAll route
parent
e4329ba7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
20 deletions
+21
-20
App.jsx
frontend/src/App.jsx
+2
-1
order_actions.js
frontend/src/actions/order_actions.js
+3
-3
OrderIndex.jsx
frontend/src/components/order/OrderIndex.jsx
+1
-1
orders_reducer.js
frontend/src/reducers/entities/orders_reducer.js
+3
-3
orders_api_util.jsx
frontend/src/util/orders_api_util.jsx
+12
-12
No files found.
frontend/src/App.jsx
View file @
bda5bf1b
...
@@ -16,7 +16,8 @@ const App = ({ orders, fetchOrders }) => {
...
@@ -16,7 +16,8 @@ const App = ({ orders, fetchOrders }) => {
setFetchAttempted
(
true
);
setFetchAttempted
(
true
);
fetchOrders
();
fetchOrders
();
}
}
},
[
fetchOrders
,
fetchAttempted
]);
setOrdersToShow
(
orders
);
},
[
orders
,
fetchOrders
,
fetchAttempted
]);
return
(
return
(
<
div
className=
"app"
>
<
div
className=
"app"
>
...
...
frontend/src/actions/order_actions.js
View file @
bda5bf1b
...
@@ -22,19 +22,19 @@ const updateOrder = (order) => ({
...
@@ -22,19 +22,19 @@ const updateOrder = (order) => ({
export
const
fetchOrders
=
()
=>
(
dispatch
)
=>
{
export
const
fetchOrders
=
()
=>
(
dispatch
)
=>
{
OrderAPIUtil
.
getOrders
()
OrderAPIUtil
.
getOrders
()
.
then
(
res
=>
{
.
then
(
res
=>
{
dispatch
(
receiveOrders
(
res
))
dispatch
(
receiveOrders
(
res
.
data
))
});
});
}
}
export
const
createOrder
=
(
order
)
=>
(
dispatch
)
=>
export
const
createOrder
=
(
order
)
=>
(
dispatch
)
=>
OrderAPIUtil
.
createOrder
(
order
)
OrderAPIUtil
.
createOrder
(
order
)
.
then
(
res
=>
{
.
then
(
res
=>
{
dispatch
(
receiveOrder
(
res
))
dispatch
(
receiveOrder
(
res
.
data
))
});
});
export
const
editOrder
=
(
order
)
=>
(
dispatch
)
=>
{
export
const
editOrder
=
(
order
)
=>
(
dispatch
)
=>
{
OrderAPIUtil
.
editOrder
(
order
)
OrderAPIUtil
.
editOrder
(
order
)
.
then
(
res
=>
{
.
then
(
res
=>
{
dispatch
(
updateOrder
(
res
))
dispatch
(
updateOrder
(
res
.
data
))
});
});
}
}
\ No newline at end of file
frontend/src/components/order/OrderIndex.jsx
View file @
bda5bf1b
...
@@ -23,7 +23,7 @@ const OrderIndex = ({
...
@@ -23,7 +23,7 @@ const OrderIndex = ({
}
}
const
mapStateToProps
=
(
state
,
ownProps
)
=>
{
const
mapStateToProps
=
(
state
,
ownProps
)
=>
{
debugger
;
//
debugger;
return
{
return
{
orders
:
ownProps
.
orders
,
orders
:
ownProps
.
orders
,
}
}
...
...
frontend/src/reducers/entities/orders_reducer.js
View file @
bda5bf1b
...
@@ -20,9 +20,9 @@ const OrdersReducer = (oldState = initialState, action) => {
...
@@ -20,9 +20,9 @@ const OrdersReducer = (oldState = initialState, action) => {
byId
:
{},
byId
:
{},
allIds
:
[],
allIds
:
[],
};
};
Object
.
keys
(
action
.
orders
).
forEach
(
wareId
=>
{
action
.
orders
.
forEach
(
order
=>
{
orderState
.
allIds
.
push
(
wareI
d
);
orderState
.
allIds
.
push
(
order
.
i
d
);
orderState
.
byId
[
wareId
]
=
action
.
orders
[
wareId
]
;
orderState
.
byId
[
order
.
id
]
=
order
;
})
})
return
orderState
;
return
orderState
;
case
RECEIVE_ORDER
:
case
RECEIVE_ORDER
:
...
...
frontend/src/util/orders_api_util.jsx
View file @
bda5bf1b
//
import axios from 'axios';
import
axios
from
'axios'
;
const
RECEIVED
=
"RECEIVED"
;
const
RECEIVED
=
"RECEIVED"
;
// const FULFILLED = "FULFILLED";
// const FULFILLED = "FULFILLED";
// const CANCELLED = "CANCELLED";
// const CANCELLED = "CANCELLED";
const
sampleGetAll
=
{
const
sampleGetAll
=
[
// allIds: ["1", "2", "3"],
// allIds: ["1", "2", "3"],
// byId: {
// byId: {
1
:
{
{
id
:
"1"
,
id
:
"1"
,
orderId
:
"o1"
,
orderId
:
"o1"
,
status
:
RECEIVED
,
status
:
RECEIVED
,
...
@@ -28,7 +28,7 @@ const sampleGetAll = {
...
@@ -28,7 +28,7 @@ const sampleGetAll = {
},
},
],
],
},
},
2
:
{
{
id
:
"2"
,
id
:
"2"
,
orderId
:
"o2"
,
orderId
:
"o2"
,
status
:
RECEIVED
,
status
:
RECEIVED
,
...
@@ -49,7 +49,7 @@ const sampleGetAll = {
...
@@ -49,7 +49,7 @@ const sampleGetAll = {
},
},
],
],
},
},
3
:
{
{
id
:
"3"
,
id
:
"3"
,
orderId
:
"o3"
,
orderId
:
"o3"
,
status
:
RECEIVED
,
status
:
RECEIVED
,
...
@@ -71,7 +71,7 @@ const sampleGetAll = {
...
@@ -71,7 +71,7 @@ const sampleGetAll = {
],
],
},
},
// },
// },
}
;
]
;
const
sampleNew
=
{
const
sampleNew
=
{
id
:
"4"
,
id
:
"4"
,
...
@@ -86,9 +86,9 @@ const createNewPromise = new Promise( (resolve, reject) => {
...
@@ -86,9 +86,9 @@ const createNewPromise = new Promise( (resolve, reject) => {
resolve
(
sampleNew
)
resolve
(
sampleNew
)
})
})
export
const
getOrders
=
()
=>
{
//
export const getOrders = () => {
return
getAllPromise
;
//
return getAllPromise;
};
//
};
export
const
createOrder
=
(
order
)
=>
{
export
const
createOrder
=
(
order
)
=>
{
return
createNewPromise
;
return
createNewPromise
;
...
@@ -100,6 +100,6 @@ export const editOrder = (order) => {
...
@@ -100,6 +100,6 @@ export const editOrder = (order) => {
})
})
}
}
// export const getOrders =() => {
export
const
getOrders
=
()
=>
{
// return axios.get("http://localhost:8080/api/orders");
return
axios
.
get
(
"http://localhost:8080/api/orders"
);
// }
}
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment