+
{{ utils.dateFormat(currentArticle?.publishedOn, "dddd, DD/MM/YYYY - HH:mm") }}
diff --git a/server/api/articles/[...].ts b/server/api/articles/[...].ts
index 90ecee8..7de7cc4 100644
--- a/server/api/articles/[...].ts
+++ b/server/api/articles/[...].ts
@@ -5,5 +5,5 @@ const router = createRouter()
router.get('/get-by-id/:id', defineEventHandler(DynamicArticleCtrl.getArticleById))
router.get('/get-by-slug/:slug', defineEventHandler(DynamicArticleCtrl.getArticleBySlug))
-
+router.post('/condition', defineEventHandler(DynamicArticleCtrl.listArticleCondition))
export default useBase('/api/articles', router.handler)
diff --git a/server/models/articles/index.ts b/server/models/articles/index.ts
index c9dc8da..c70d820 100644
--- a/server/models/articles/index.ts
+++ b/server/models/articles/index.ts
@@ -1,3 +1,4 @@
+import { H3Event } from 'h3';
interface Base {
createdBy?: string | number
createdOn?: string
@@ -88,3 +89,24 @@ export const getArticleBySlug = async (event : any) => {
handleError(error);
}
}
+
+export const listArticleCondition = async (event: H3Event) => {
+ try {
+ const payload = await readBody
(event)
+ const { apiUrl } = useRuntimeConfig().public
+ const { items }: any = await $fetch(`${apiUrl}/cms/article/condition`, {
+ method: "POST",
+ headers: {
+ Site: 1
+ },
+ body: {
+ payload
+ }
+ })
+ // log(event)
+
+ return items
+ } catch (error) {
+ handleError(error);
+ }
+}
\ No newline at end of file
diff --git a/stores/articles.ts b/stores/articles.ts
index 388ea34..0ae8a18 100644
--- a/stores/articles.ts
+++ b/stores/articles.ts
@@ -1,5 +1,9 @@
+interface ArticleCondition {
+ ids?: number[]
+}
export const useArticleStore = defineStore("article", () => {
const currentArticle = ref({});
+ const currentArticles = ref([])
const getArticleById = async (id: string | number) => {
try {
@@ -18,10 +22,23 @@ export const useArticleStore = defineStore("article", () => {
} catch (error: any) {}
}
+ const getArticleCondition = async (condition: ArticleCondition) => {
+ try {
+ const { data: articles } = await useFetch(`/api/articles/condition`, {
+ method: 'POST',
+ body: condition
+ })
+ console.log(articles, 'data')
+ } catch (error: any) {
+
+ }
+ }
+
return {
currentArticle,
getArticleById,
- getArticleBySlug
+ getArticleBySlug,
+ getArticleCondition
}
});
diff --git a/uno.config.ts b/uno.config.ts
index dab8d87..03ba25c 100644
--- a/uno.config.ts
+++ b/uno.config.ts
@@ -19,6 +19,9 @@ export default defineConfig({
500: "#2563eb",
600: "#3c7abc",
},
+ 'gray': {
+ 600:' #757575'
+ }
// 'red': '#ff0018',
// 'blue': '#2d6cf6',
// 'brown-700': '#99553D',