Commit 668f560c by Giang Tran

update code

parent 0966bc70
/* eslint-disable handle-callback-err */
import { PostData, GetURL } from '../../helpers'
import url from '../../url'
export const getListCategorys = async (body) =>
PostData(url.urlGetCategory, body)
.then((res) => res)
.catch((err) => null)
export const createCategory = async (body) =>
PostData(url.urlCreateCategory, body)
.then((res) => res)
.catch((err) => null)
export const updateCategory = async (body) =>
PostData(url.urlUpdateCategory, body)
.then((res) => res)
.catch((err) => null)
export const detailCategory = async (id, body) =>
GetURL(`${url.urlDetailCategory}/${id}`, body)
.then((res) => res)
.catch((err) => null)
export const deleteCategory = async (body) =>
PostData(url.urlDeleteCategory, body)
.then((res) => res)
.catch((err) => null)
/* eslint-disable handle-callback-err */
import { PostData, GetURL } from '../../helpers'
import url from '../../url'
export const getListCategoryTypes = async (body) =>
PostData(url.urlGetCategoryType, body)
.then((res) => res)
.catch((err) => null)
export const createCategoryType = async (body) =>
PostData(url.urlCreateCategoryType, body)
.then((res) => res)
.catch((err) => null)
export const updateCategoryType = async (body) =>
PostData(url.urlUpdateCategoryType, body)
.then((res) => res)
.catch((err) => null)
export const detailCategoryType = async (id, body) =>
GetURL(`${url.urlDetailCategoryType}/${id}`, body)
.then((res) => res)
.catch((err) => null)
export const deleteCategoryType = async (body) =>
PostData(url.urlDeleteCategoryType, body)
.then((res) => res)
.catch((err) => null)
/* eslint-disable handle-callback-err */
import { PostData, GetURL, GetData } from '../../helpers'
import url from '../../url'
export const getLogAuth = async (body) =>
PostData(url.logAuth, body)
.then((res) => res)
.catch((err) => null)
export const getLogAction = async (body) =>
PostData(url.logAction, body)
.then((res) => res)
.catch((err) => null)
export const getLogApi = async (body) =>
PostData(url.logApi, body)
.then((res) => res)
.catch((err) => null)
......@@ -37,6 +37,15 @@ export default {
urlListActionByGroup: `${root}/usergroup/permission`,
changeStatusGroup: `${root}/usergroup/changeStatus`,
// Tài khoản
urlGetEmployee: `${root}/user/list`,
urlCreateEmployee: `${root}/user/create`,
urlUpdateEmployee: `${root}/user/update`,
urlDeleteEmployee: `${root}/user/delete`,
urlDetailEmployee: `${root}/user`,
changeStatusEmployee: `${root}/user/changeStatus`,
actionByGroup: `${root}/usergroup/permission`,
//product-type
urlGetListProductType: `${root}/poducttype/list`,
urlCreateProductType: `${root}/poducttype/create`,
......@@ -53,6 +62,11 @@ export default {
urlDetailProduct: `${root}/product`,
changeStatusProduct: `${root}/product/changeStatus`,
//Log
logAuth: `${root}/logging/listLogin`,
logApi: `${root}/logging/listCallApi`,
logAction: `${root}/logging/listAction`,
//dropdown
dropdownFuntions: `${root}/dropdown/function`,
dropdownPermission: `${root}/function/getFunctionTree`,
......
......@@ -187,7 +187,7 @@ function TableList(props) {
className={classes.formControl}
>
<MenuItem value={1}>
Hin th
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
......
......@@ -56,27 +56,29 @@ const ToolNotificate = (props) => {
}
const getData = async () => {
props.showLoading()
const res = await getListEmployees({
full_name: searchDebount,
page_no: pageIndex + 1,
page_size: pageSize,
})
props.hideLoading()
if (res.data.code == 200 && res.data.data) {
const newList = res.data.data.data.map((e, i) => {
return { ...e, index: i + 1 + pageIndex * pageSize }
try {
props.showLoading()
const res = await getListEmployees({
full_name: searchDebount,
page_no: pageIndex + 1,
page_size: pageSize,
})
setData(newList)
setTotalRecord(res.data.data.total_elements)
} else if (res.data.code == 401) {
localStorage.removeItem(KEY.API_TOKEN)
setTimeout(() => {
history.push('/')
}, 100)
} else {
// enqueueSnackbar('Error!', { variant: 'error' })
}
props.hideLoading()
if (res.data.code == 200 && res.data.data) {
const newList = res.data.data.data.map((e, i) => {
return { ...e, index: i + 1 + pageIndex * pageSize }
})
setData(newList)
setTotalRecord(res.data.data.total_elements)
} else if (res.data.code == 401) {
localStorage.removeItem(KEY.API_TOKEN)
setTimeout(() => {
history.push('/')
}, 100)
} else {
// enqueueSnackbar('Error!', { variant: 'error' })
}
} catch (error) {}
}
useEffect(() => {
......
......@@ -185,7 +185,7 @@ function TableList(props) {
className={classes.formControl}
>
<MenuItem value={1}>
Hin th
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
......
......@@ -192,7 +192,7 @@ function TableList(props) {
className={classes.formControl}
>
<MenuItem value={1}>
Hin th
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
......
......@@ -184,7 +184,7 @@ function TableList(props) {
className={classes.formControl}
>
<MenuItem value={1}>
Hin th
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
......
......@@ -192,7 +192,7 @@ function TableList(props) {
className={classes.formControl}
>
<MenuItem value={1}>
Hin th
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
......
......@@ -184,7 +184,7 @@ function TableList(props) {
className={classes.formControl}
>
<MenuItem value={1}>
Hin th
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
......
......@@ -179,7 +179,7 @@ function TableList(props) {
className={classes.formControl}
>
<MenuItem value={1}>
Hin th
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment