Commit ea171371 authored by Tình Trương's avatar Tình Trương

update

parent 0c577f62
......@@ -71,4 +71,5 @@ export enum API_PATHS {
detailCustomer = 'customer/detail',
updateCustomer = 'customer/update',
getPostCategory = 'postCategory',
addPost = 'post/add',
}
......@@ -45,13 +45,13 @@
hide-pagination
class="sticky-header-table"
>
<template v-slot:body-cell-STT="item">
<!-- <template v-slot:body-cell-STT="item">
<q-td style="padding: 0; height: 100%">
<div align="center">
{{ item.rowIndex + 1 }}
</div>
</q-td>
</template>
</template> -->
<template v-slot:body-cell-action="item">
<q-td style="padding: 0">
<div align="center">
......@@ -162,9 +162,10 @@ import { AxiosResponse } from 'axios';
import { api, BaseResponseBody } from 'src/boot/axios';
import {
PaginationResponse,
Post,
PostType,
FileUploadType,
CategoryPostType,
PostDetailType,
} from 'src/assets/type';
import { config } from 'src/assets/configurations';
import { PostStatus } from 'src/assets/enums';
......@@ -182,14 +183,14 @@ export default defineComponent({
},
setup() {
const postTableColumns = [
{
name: 'STT',
field: 'STT',
required: true,
label: 'STT',
align: 'center',
sortable: false,
},
// {
// name: 'STT',
// field: 'STT',
// required: true,
// label: 'STT',
// align: 'center',
// sortable: false,
// },
{
name: 'name',
field: 'name',
......@@ -309,7 +310,7 @@ export default defineComponent({
pageSize: pageSize.value,
name: namePost.value,
},
})) as AxiosResponse<BaseResponseBody<PaginationResponse<Post>>>;
})) as AxiosResponse<BaseResponseBody<PaginationResponse<PostType>>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
postTableRows.value = response.data.data.data;
totalPage.value = response.data.data.totalPages;
......@@ -362,24 +363,25 @@ export default defineComponent({
//gọi api add
const addNewPost = async () => {
// const data = {
// name: name.value,
// status: status.value,
// };
// const response = (await api({
// url: API_PATHS.addPost,
// method: 'POST',
// data,
// })) as AxiosResponse<BaseResponseBody<[]>>;
// if (response.data.error.code === config.API_RES_CODE.OK.code) {
// addPostDialogIsOpened.value = false;
// Notify.create({
// type: 'positive',
// message: i18n.global.t('post.actionMessages.addNewPostAccess'),
// actions: [{ icon: 'close', color: 'white' }],
// });
// void getListPost();
// }
const data = {
image: image.value,
status: status.value,
category: category.value,
};
const response = (await api({
url: API_PATHS.addPost,
method: 'POST',
data,
})) as AxiosResponse<BaseResponseBody<PostDetailType[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
addPostDialogIsOpened.value = false;
Notify.create({
type: 'positive',
message: i18n.global.t('post.actionMessages.addNewPostAccess'),
actions: [{ icon: 'close', color: 'white' }],
});
void getListPost();
}
};
const openUpdatePostDialog = (id: number) => {
......
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