Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chengyan phase2 reusable purchase item form frontend #1979

Merged
26 changes: 23 additions & 3 deletions src/actions/bmdashboard/invTypeActions.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
import axios from "axios";

import { ENDPOINTS } from "utils/URL";
import GET_MATERIAL_TYPES, { POST_BUILDING_MATERIAL_INVENTORY_TYPE, POST_ERROR_BUILDING_MATERIAL_INVENTORY_TYPE, RESET_POST_BUILDING_MATERIAL_INVENTORY_TYPE, GET_INV_BY_TYPE, GET_TOOL_TYPES } from "constants/bmdashboard/inventoryTypeConstants";

import GET_MATERIAL_TYPES, { POST_BUILDING_MATERIAL_INVENTORY_TYPE, POST_ERROR_BUILDING_MATERIAL_INVENTORY_TYPE, RESET_POST_BUILDING_MATERIAL_INVENTORY_TYPE, GET_INV_BY_TYPE, GET_TOOL_TYPES, GET_REUSABLE_TYPES } from "constants/bmdashboard/inventoryTypeConstants";
import { GET_ERRORS } from "constants/errors";

export const fetchMaterialTypes = () => {
return async dispatch => {
axios.get(ENDPOINTS.BM_MATERIAL_TYPES)
.then(res => {
dispatch(setInvTypes(res.data))
dispatch(setMaterialTypes(res.data))
})
.catch(err => {
dispatch(setErrors(err))
})
}
}

export const fetchReusableTypes = () => {
return async dispatch => {
axios.get(ENDPOINTS.BM_REUSABLE_TYPES)
.then(res => {
dispatch(setReusableTypes(res.data))
})
.catch(err => {
dispatch(setErrors(err))
Expand Down Expand Up @@ -74,13 +87,20 @@ export const resetPostBuildingInventoryTypeResult = () => {
}


export const setInvTypes = payload => {
export const setMaterialTypes = payload => {
return {
type: GET_MATERIAL_TYPES,
payload
}
}

export const setReusableTypes = payload => {
return {
type: GET_REUSABLE_TYPES,
payload
}
}

export const setToolTypes = payload => {
return {
type: GET_TOOL_TYPES,
Expand Down
12 changes: 11 additions & 1 deletion src/actions/bmdashboard/reusableActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@ export const fetchAllReusables = () => {
dispatch(setErrors(err))
})
}
}
}

export const purchaseReusable = async (body) => {
return axios.post(ENDPOINTS.BM_PURCHASE_REUSABLES, body)
.then(res => res)
.catch((err) => {
if (err.response) return err.response
if (err.request) return err.request
return err.message
})
}

This file was deleted.

193 changes: 0 additions & 193 deletions src/components/BMDashboard/MaterialPurchaseRequest/PurchaseForm.jsx

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/BMDashboard/MaterialPurchaseRequest/index.js

This file was deleted.

Loading
Loading