fix: 화면 정리

미사용 소스정리
main
minuk926 3 years ago
parent 408ec70720
commit fe9d9996fa

@ -8,11 +8,7 @@ import { dispatch } from '../index';
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
const initialState = { const initialState = {
error: null, error: null
customers: [],
orders: [],
products: [],
productreviews: []
}; };
const slice = createSlice({ const slice = createSlice({
@ -22,27 +18,27 @@ const slice = createSlice({
// HAS ERROR // HAS ERROR
hasError(state, action) { hasError(state, action) {
state.error = action.payload; state.error = action.payload;
},
// GET CUSTOMERS
getCustomersSuccess(state, action) {
state.customers = action.payload;
},
// GET ORDERS
getOrdersSuccess(state, action) {
state.orders = action.payload;
},
// GET PRODUCTS
getProductsSuccess(state, action) {
state.products = action.payload;
},
// GET PRODUCT REVIEWS
getProductReviewsSuccess(state, action) {
state.productreviews = action.payload;
} }
// // GET CUSTOMERS
// getCustomersSuccess(state, action) {
// state.customers = action.payload;
// },
//
// // GET ORDERS
// getOrdersSuccess(state, action) {
// state.orders = action.payload;
// },
//
// // GET PRODUCTS
// getProductsSuccess(state, action) {
// state.products = action.payload;
// },
//
// // GET PRODUCT REVIEWS
// getProductReviewsSuccess(state, action) {
// state.productreviews = action.payload;
// }
} }
}); });
@ -51,46 +47,46 @@ export default slice.reducer;
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
export function getCustomers() { // export function getCustomers() {
return async () => { // return async () => {
try { // try {
const response = await axios.get('/api/customer/list'); // const response = await axios.get('/api/customer/list');
dispatch(slice.actions.getCustomersSuccess(response.data.customers)); // dispatch(slice.actions.getCustomersSuccess(response.data.customers));
} catch (error) { // } catch (error) {
dispatch(slice.actions.hasError(error)); // dispatch(slice.actions.hasError(error));
} // }
}; // };
} // }
//
export function getOrders() { // export function getOrders() {
return async () => { // return async () => {
try { // try {
const response = await axios.get('/api/customer/order/list'); // const response = await axios.get('/api/customer/order/list');
dispatch(slice.actions.getOrdersSuccess(response.data.orders)); // dispatch(slice.actions.getOrdersSuccess(response.data.orders));
} catch (error) { // } catch (error) {
dispatch(slice.actions.hasError(error)); // dispatch(slice.actions.hasError(error));
} // }
}; // };
} // }
//
export function getProducts() { // export function getProducts() {
return async () => { // return async () => {
try { // try {
const response = await axios.get('/api/customer/product/list'); // const response = await axios.get('/api/customer/product/list');
dispatch(slice.actions.getProductsSuccess(response.data.products)); // dispatch(slice.actions.getProductsSuccess(response.data.products));
} catch (error) { // } catch (error) {
dispatch(slice.actions.hasError(error)); // dispatch(slice.actions.hasError(error));
} // }
}; // };
} // }
//
export function getProductReviews() { // export function getProductReviews() {
return async () => { // return async () => {
try { // try {
const response = await axios.get('/api/customer/product/reviews'); // const response = await axios.get('/api/customer/product/reviews');
dispatch(slice.actions.getProductReviewsSuccess(response.data.productreviews)); // dispatch(slice.actions.getProductReviewsSuccess(response.data.productreviews));
} catch (error) { // } catch (error) {
dispatch(slice.actions.hasError(error)); // dispatch(slice.actions.hasError(error));
} // }
}; // };
} // }

Loading…
Cancel
Save