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 { ...@@ -37,6 +37,15 @@ export default {
urlListActionByGroup: `${root}/usergroup/permission`, urlListActionByGroup: `${root}/usergroup/permission`,
changeStatusGroup: `${root}/usergroup/changeStatus`, 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 //product-type
urlGetListProductType: `${root}/poducttype/list`, urlGetListProductType: `${root}/poducttype/list`,
urlCreateProductType: `${root}/poducttype/create`, urlCreateProductType: `${root}/poducttype/create`,
...@@ -53,6 +62,11 @@ export default { ...@@ -53,6 +62,11 @@ export default {
urlDetailProduct: `${root}/product`, urlDetailProduct: `${root}/product`,
changeStatusProduct: `${root}/product/changeStatus`, changeStatusProduct: `${root}/product/changeStatus`,
//Log
logAuth: `${root}/logging/listLogin`,
logApi: `${root}/logging/listCallApi`,
logAction: `${root}/logging/listAction`,
//dropdown //dropdown
dropdownFuntions: `${root}/dropdown/function`, dropdownFuntions: `${root}/dropdown/function`,
dropdownPermission: `${root}/function/getFunctionTree`, dropdownPermission: `${root}/function/getFunctionTree`,
......
...@@ -187,7 +187,7 @@ function TableList(props) { ...@@ -187,7 +187,7 @@ function TableList(props) {
className={classes.formControl} className={classes.formControl}
> >
<MenuItem value={1}> <MenuItem value={1}>
Hin th Hot động
</MenuItem> </MenuItem>
<MenuItem value={2}>Khóa</MenuItem> <MenuItem value={2}>Khóa</MenuItem>
</Select> </Select>
......
...@@ -56,27 +56,29 @@ const ToolNotificate = (props) => { ...@@ -56,27 +56,29 @@ const ToolNotificate = (props) => {
} }
const getData = async () => { const getData = async () => {
props.showLoading() try {
const res = await getListEmployees({ props.showLoading()
full_name: searchDebount, const res = await getListEmployees({
page_no: pageIndex + 1, full_name: searchDebount,
page_size: pageSize, 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 }
}) })
setData(newList) props.hideLoading()
setTotalRecord(res.data.data.total_elements) if (res.data.code == 200 && res.data.data) {
} else if (res.data.code == 401) { const newList = res.data.data.data.map((e, i) => {
localStorage.removeItem(KEY.API_TOKEN) return { ...e, index: i + 1 + pageIndex * pageSize }
setTimeout(() => { })
history.push('/') setData(newList)
}, 100) setTotalRecord(res.data.data.total_elements)
} else { } else if (res.data.code == 401) {
// enqueueSnackbar('Error!', { variant: 'error' }) localStorage.removeItem(KEY.API_TOKEN)
} setTimeout(() => {
history.push('/')
}, 100)
} else {
// enqueueSnackbar('Error!', { variant: 'error' })
}
} catch (error) {}
} }
useEffect(() => { useEffect(() => {
......
...@@ -185,7 +185,7 @@ function TableList(props) { ...@@ -185,7 +185,7 @@ function TableList(props) {
className={classes.formControl} className={classes.formControl}
> >
<MenuItem value={1}> <MenuItem value={1}>
Hin th Hot động
</MenuItem> </MenuItem>
<MenuItem value={2}>Khóa</MenuItem> <MenuItem value={2}>Khóa</MenuItem>
</Select> </Select>
......
...@@ -192,7 +192,7 @@ function TableList(props) { ...@@ -192,7 +192,7 @@ function TableList(props) {
className={classes.formControl} className={classes.formControl}
> >
<MenuItem value={1}> <MenuItem value={1}>
Hin th Hot động
</MenuItem> </MenuItem>
<MenuItem value={2}>Khóa</MenuItem> <MenuItem value={2}>Khóa</MenuItem>
</Select> </Select>
......
...@@ -184,7 +184,7 @@ function TableList(props) { ...@@ -184,7 +184,7 @@ function TableList(props) {
className={classes.formControl} className={classes.formControl}
> >
<MenuItem value={1}> <MenuItem value={1}>
Hin th Hot động
</MenuItem> </MenuItem>
<MenuItem value={2}>Khóa</MenuItem> <MenuItem value={2}>Khóa</MenuItem>
</Select> </Select>
......
...@@ -192,7 +192,7 @@ function TableList(props) { ...@@ -192,7 +192,7 @@ function TableList(props) {
className={classes.formControl} className={classes.formControl}
> >
<MenuItem value={1}> <MenuItem value={1}>
Hin th Hot động
</MenuItem> </MenuItem>
<MenuItem value={2}>Khóa</MenuItem> <MenuItem value={2}>Khóa</MenuItem>
</Select> </Select>
......
...@@ -184,7 +184,7 @@ function TableList(props) { ...@@ -184,7 +184,7 @@ function TableList(props) {
className={classes.formControl} className={classes.formControl}
> >
<MenuItem value={1}> <MenuItem value={1}>
Hin th Hot động
</MenuItem> </MenuItem>
<MenuItem value={2}>Khóa</MenuItem> <MenuItem value={2}>Khóa</MenuItem>
</Select> </Select>
......
...@@ -179,7 +179,7 @@ function TableList(props) { ...@@ -179,7 +179,7 @@ function TableList(props) {
className={classes.formControl} className={classes.formControl}
> >
<MenuItem value={1}> <MenuItem value={1}>
Hin th Hot động
</MenuItem> </MenuItem>
<MenuItem value={2}>Khóa</MenuItem> <MenuItem value={2}>Khóa</MenuItem>
</Select> </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