| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | 
							- export const CHANGE_THEME = "CHANGE_THEME";
 
- export const PELAPORAN_LIST_REQUEST = "PELAPORAN_LIST_REQUEST";
 
- export const PELAPORAN_LIST_SUCCESS = "PELAPORAN_LIST_SUCCESS";
 
- export const PELAPORAN_LIST_FAIL = "PELAPORAN_LIST_FAIL";
 
- export const PELAPORAN_DETAILS_REQUEST = "PELAPORAN_DETAILS_REQUEST";
 
- export const PELAPORAN_DETAILS_SUCCESS = "PELAPORAN_DETAILS_SUCCESS";
 
- export const PELAPORAN_DETAILS_FAIL = "PELAPORAN_DETAILS_FAIL";
 
- export const PELAPORAN_CREATE_REQUEST = "PELAPORAN_DETAILS_REQUEST";
 
- export const PELAPORAN_CREATE_SUCCESS = "PELAPORAN_DETAILS_SUCCESS";
 
- export const PELAPORAN_CREATE_FAIL = "PELAPORAN_DETAILS_FAIL";
 
- export const PELAPORAN_CREATE_RESET = "PELAPORAN_CREATE_RESET";
 
- /**
 
-  * Change current theme path
 
-  */
 
- export const listPelaporan = () => async (dispatch) => {
 
- 	try {
 
- 		dispatch({ type: PELAPORAN_LIST_REQUEST });
 
- 		const res = await fetch("http://ptb-Backend:5000/pelaporan");
 
- 		const { data } = await res.json();
 
- 		dispatch({
 
- 			type: PELAPORAN_LIST_SUCCESS,
 
- 			payload: data,
 
- 		});
 
- 	} catch (error) {
 
- 		dispatch({
 
- 			type: PELAPORAN_LIST_FAIL,
 
- 			payload: error.response && error.response.data.message ? error.response.data.message : error.message,
 
- 		});
 
- 	}
 
- };
 
- export const listPelaporanDetails = (number, ptId) => async (dispatch) => {
 
- 	try {
 
- 		dispatch({ type: PELAPORAN_DETAILS_REQUEST });
 
- 		const res = await fetch(`http://ptb-Backend:5000/pelaporan?number=${number}&ptId=${ptId}`);
 
- 		const { data } = await res.json();
 
- 		dispatch({
 
- 			type: PELAPORAN_DETAILS_SUCCESS,
 
- 			payload: data,
 
- 		});
 
- 	} catch (error) {
 
- 		dispatch({
 
- 			type: PELAPORAN_DETAILS_FAIL,
 
- 			payload: error.response && error.response.data.message ? error.response.data.message : error.message,
 
- 		});
 
- 	}
 
- };
 
- export const createPelaporan = (pelaporanResult) => async (dispatch) => {
 
- 	try {
 
- 		dispatch({
 
- 			type: PELAPORAN_CREATE_REQUEST,
 
- 		});
 
- 		const res = await fetch("http://ptb-Backend:5000/pelaporan/create", {
 
- 			method: "POST",
 
- 			body: pelaporanResult,
 
- 		});
 
- 		const data = await res.json();
 
- 		dispatch({
 
- 			type: PELAPORAN_CREATE_SUCCESS,
 
- 			payload: data,
 
- 		});
 
- 	} catch (error) {
 
- 		dispatch({
 
- 			type: PELAPORAN_CREATE_FAIL,
 
- 			payload: error.response && error.response.data.message ? error.response.data.message : error.message,
 
- 		});
 
- 	}
 
- };
 
 
  |