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

update

parent 18f31f91
...@@ -308,6 +308,15 @@ export default defineComponent({ ...@@ -308,6 +308,15 @@ export default defineComponent({
} }
); );
watch(
() => formatSchedules.value,
(value) => {
if (value) {
console.log(value, 'aaa');
}
}
);
const getInformationArtist = async () => { const getInformationArtist = async () => {
const response = (await api({ const response = (await api({
url: API_PATHS.getDetailArtist, url: API_PATHS.getDetailArtist,
...@@ -767,6 +776,30 @@ export default defineComponent({ ...@@ -767,6 +776,30 @@ export default defineComponent({
} }
} }
// cách 1: dùng reduce
const schedules: Array<{ scheduleTime: string }> =
formatSchedules.value.reduce(
(acc: Array<{ scheduleTime: string }>, item) => {
acc.push({
scheduleTime: moment(item, 'YYYY/MM/DD').format(
'DD/MM/YYYY HH:mm:ss'
),
});
return acc;
},
[]
);
// cach 2: dùng for
// const schedules: Array<{ scheduleTime: string }> = [];
// for (let idx = 0; idx < formatSchedules.value.length; idx++) {
// schedules.push({
// scheduleTime: moment(
// formatSchedules.value[idx],
// 'YYYY/MM/DD'
// ).format('DD/MM/YYYY HH:mm:ss'),
// });
// }
const response = (await api({ const response = (await api({
url: API_PATHS.updateArtist, url: API_PATHS.updateArtist,
method: 'POST', method: 'POST',
...@@ -798,7 +831,7 @@ export default defineComponent({ ...@@ -798,7 +831,7 @@ export default defineComponent({
works: works.value, works: works.value,
banners: banners.value, banners: banners.value,
bankAccounts: bankAccounts.value, bankAccounts: bankAccounts.value,
schedules: schedules.value, schedules,
stories: stories.value, stories: stories.value,
products: products.value, products: products.value,
}, },
......
...@@ -3,7 +3,7 @@ import { api, BaseResponseBody } from 'src/boot/axios'; ...@@ -3,7 +3,7 @@ import { api, BaseResponseBody } from 'src/boot/axios';
import { API_PATHS, config } from 'src/assets/configurations'; import { API_PATHS, config } from 'src/assets/configurations';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import moment from 'moment';
import { i18n } from 'src/boot/i18n'; import { i18n } from 'src/boot/i18n';
import { Dialog, Notify } from 'quasar'; import { Dialog, Notify } from 'quasar';
import { Router } from 'src/router'; import { Router } from 'src/router';
...@@ -701,6 +701,20 @@ export default defineComponent({ ...@@ -701,6 +701,20 @@ export default defineComponent({
} }
} }
// cách 1: dùng reduce
const schedules: Array<{ scheduleTime: string }> =
formatSchedules.value.reduce(
(acc: Array<{ scheduleTime: string }>, item) => {
acc.push({
scheduleTime: moment(item, 'YYYY/MM/DD').format(
'DD/MM/YYYY HH:mm:ss'
),
});
return acc;
},
[]
);
const response = (await api({ const response = (await api({
url: API_PATHS.addArtist, url: API_PATHS.addArtist,
method: 'POST', method: 'POST',
...@@ -733,7 +747,7 @@ export default defineComponent({ ...@@ -733,7 +747,7 @@ export default defineComponent({
works: works.value, works: works.value,
banners: banners.value, banners: banners.value,
bankAccounts: bankAccounts.value, bankAccounts: bankAccounts.value,
schedules: schedules.value, schedules,
stories: stories.value, stories: stories.value,
products: products.value, products: products.value,
}, },
......
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