File tree 4 files changed +14
-8
lines changed
components/layouts/contents/material
4 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 1
1
# Bouquet::Gate
2
2
3
- This project rocks and uses MIT-LICENSE.
4
-
3
+ ## API
5
4
5
+ ### Purchase Order
6
6
7
7
```
8
8
POST api/purchase_orders
@@ -15,11 +15,13 @@ POST api/purchase_orders
15
15
}
16
16
```
17
17
18
+ ### Sales Order
19
+
18
20
```
19
21
POST api/sales_orders
20
22
21
23
{
22
- "quantity": 10 ,
24
+ "quantity": 1 ,
23
25
"shipment_date": "2014-03-21",
24
26
"product_id": 1,
25
27
"customer_id": 1
Original file line number Diff line number Diff line change 1
1
import * as types from '../constants/ActionTypes'
2
2
import 'isomorphic-fetch'
3
3
4
+ const endpoint = 'http://localhost:3000'
5
+
4
6
export function receiveMaterials ( materials ) {
5
7
return {
6
8
type : types . MATERIAL_RECEIVE ,
@@ -10,7 +12,7 @@ export function receiveMaterials(materials) {
10
12
11
13
export function searchMaterials ( ) {
12
14
return dispatch => {
13
- return fetch ( '/api/materials' )
15
+ return fetch ( endpoint + '/api/materials' )
14
16
. then ( response => response . json ( ) )
15
17
. then ( json => dispatch ( receiveMaterials ( json ) ) )
16
18
}
@@ -26,7 +28,7 @@ export function showOrder(order) {
26
28
27
29
export function purchaseOrder ( material_id ) {
28
30
return dispatch => {
29
- return fetch ( '/api/purchase_orders' , {
31
+ return fetch ( endpoint + '/api/purchase_orders' , {
30
32
method : 'post' ,
31
33
headers : {
32
34
'Accept' : 'application/json' ,
Original file line number Diff line number Diff line change 1
1
import * as types from '../constants/ActionTypes'
2
2
import 'isomorphic-fetch'
3
3
4
+ const endpoint = 'http://localhost:3000'
5
+
4
6
export function receiveProducts ( products ) {
5
7
return {
6
8
type : types . PRODUCT_RECEIVE ,
@@ -10,7 +12,7 @@ export function receiveProducts(products) {
10
12
11
13
export function searchProducts ( ) {
12
14
return dispatch => {
13
- return fetch ( '/api/products' )
15
+ return fetch ( endpoint + '/api/products' )
14
16
. then ( response => response . json ( ) )
15
17
. then ( json => dispatch ( receiveProducts ( json ) ) )
16
18
}
@@ -26,7 +28,7 @@ export function showOrder(order) {
26
28
27
29
export function salesOrder ( product_id ) {
28
30
return dispatch => {
29
- return fetch ( '/api/sales_orders' , {
31
+ return fetch ( endpoint + '/api/sales_orders' , {
30
32
method : 'post' ,
31
33
headers : {
32
34
'Accept' : 'application/json' ,
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class Layout extends Component {
22
22
return (
23
23
< Card key = { index } className = { style . material } >
24
24
< CardTitle title = { material . name } />
25
- < CardText > Sales </ CardText >
25
+ < CardText > Purchase </ CardText >
26
26
< CardActions >
27
27
< Button label = "Order"
28
28
onClick = { ::this . handleOrderClick . bind ( this , material . id ) } />
You can’t perform that action at this time.
0 commit comments