From b5a369f9fa822b61263e34beca97006c8850a3f8 Mon Sep 17 00:00:00 2001 From: wahyuun Date: Wed, 30 Aug 2023 11:47:11 +0700 Subject: [PATCH] update method request post to get in getDataProyekByCustomer --- src/const/ApiConst.js | 4 +- src/views/SimproV2/CreatedProyek/index.js | 51 +---------------------- 2 files changed, 5 insertions(+), 50 deletions(-) diff --git a/src/const/ApiConst.js b/src/const/ApiConst.js index fbaf9b1..645d3b2 100644 --- a/src/const/ApiConst.js +++ b/src/const/ApiConst.js @@ -364,7 +364,9 @@ export const PROYEK_ADD = `${BASE_SIMPRO_LUMEN}/project/add`; export const PROYEK_LIST = `${BASE_SIMPRO_LUMEN}/project/list`; export const PROYEK_SEARCH = `${BASE_SIMPRO_LUMEN}/project/search`; export const PROYEK_SEARCH_DETAIL = `${BASE_SIMPRO_LUMEN}/project/search`; -export const PROYEK_SEARCH_BY_USER = `${BASE_SIMPRO_LUMEN}/project-by-customer`; +// export const PROYEK_SEARCH_BY_USER = (id) => { +// return `${BASE_SIMPRO_LUMEN}/project-by-customer/${id}`; +// }; export const PROYEK_GET_ID = (id) => { return `${BASE_SIMPRO_LUMEN}/project/edit/${id}`; }; diff --git a/src/views/SimproV2/CreatedProyek/index.js b/src/views/SimproV2/CreatedProyek/index.js index d25ed0b..2c0180b 100644 --- a/src/views/SimproV2/CreatedProyek/index.js +++ b/src/views/SimproV2/CreatedProyek/index.js @@ -321,61 +321,14 @@ const CreatedProyek = ({ params, ...props }) => { }; const getDataProyekByCustomer = async () => { - let start = 0; - - if (currentPage !== 1 && currentPage > 1) { - start = currentPage * rowsPerPage - rowsPerPage; - } - - const payload = { - columns: [ - { - name: "nama", - logic_operator: "ilike", - value: search, - operator: "AND", - }, - ], - select: [ - "id", - "nama", - "rencana_biaya", - "type_proyek_id", - "currency_symbol", - "mulai_proyek", - "akhir_proyek", - ], - joins: [ - { - name: "m_users", - column_join: "user_id", - column_results: ["name", "username"], - }, - { - name: "m_proyek", - column_join: "proyek_id", - column_results: ["type_proyek_id"], - }, - ], - orders: { columns: ["id"], ascending: false }, - paging: { start: start, length: rowsPerPage }, - user_id: { user_id: user_id } - }; - - if (parseInt(role_id) !== 1) { - payload["columns"] = [ - { name: "id", logic_operator: "=", value: proyek_id, operator: "AND" }, - ]; - } - + const url = `${BASE_OSPRO}/api/project-by-customer/${user_id}`; const result = await axios - .post(PROYEK_SEARCH_BY_USER, payload, HEADER) + .get(url, HEADER) .then((res) => res) .catch((error) => error.response); if (result && result.data && result.data.code == 200) { let dataRes = result.data.data || []; - setDatatable(dataRes); setTotalPage(result.data.totalRecord); setLoading(false);