thainv-dev: Fix
This commit is contained in:
@@ -53,7 +53,9 @@ const parseData = computed(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<article :id="`cpn_${props.component.id}`" class="card-audio" :class="LAYOUT_PARSE['article_Class']" :style="LAYOUT_PARSE['article']">
|
<article :id="`cpn_${props.component.id}`" class="card-audio" :class="LAYOUT_PARSE['article_Class']" :style="LAYOUT_PARSE['article']">
|
||||||
<img :src="parseData?.thumbnail ? parseData?.thumbnail : 'https://indiaeducationdiary.in/wp-content/uploads/2021/02/SD-default-image.png'" :alt="parseData?.title?.replace(/<[^>]+>/g, '')" />
|
<nuxt-link :to="`/bai-viet/${parseData?.slug}`" class="article-thumbnail">
|
||||||
|
<img :src="parseData?.thumbnail ? parseData?.thumbnail : 'https://indiaeducationdiary.in/wp-content/uploads/2021/02/SD-default-image.png'" :alt="parseData?.title?.replace(/<[^>]+>/g, '')" />
|
||||||
|
</nuxt-link>
|
||||||
<div class="card-audio__content">
|
<div class="card-audio__content">
|
||||||
<span class="flex justify-center">
|
<span class="flex justify-center">
|
||||||
<template v-if="['Image', 'Infographics', 'Emagazine'].includes(type)">
|
<template v-if="['Image', 'Infographics', 'Emagazine'].includes(type)">
|
||||||
@@ -93,12 +95,18 @@ const parseData = computed(() => {
|
|||||||
padding-bottom: calc((16 / 9) * 100%);
|
padding-bottom: calc((16 / 9) * 100%);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
img {
|
.article-thumbnail {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
object-fit: cover;
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
|
& img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-audio__content {
|
.card-audio__content {
|
||||||
|
|||||||
@@ -48,11 +48,18 @@ const drop = (e: any) => {
|
|||||||
<article :id="`cpn_${props.component.id}`" class="basic-article border-custom" :class="LAYOUT_PARSE['article_Class']" :style="LAYOUT_PARSE['article']">
|
<article :id="`cpn_${props.component.id}`" class="basic-article border-custom" :class="LAYOUT_PARSE['article_Class']" :style="LAYOUT_PARSE['article']">
|
||||||
<div class="article_miss">
|
<div class="article_miss">
|
||||||
<template v-if="parseData">
|
<template v-if="parseData">
|
||||||
<div class="article_miss_thumb custom-thumb" :style="{ backgroundImage: `url('${parseData.thumbnail ? parseData.thumbnail : '/images/default-thumbnail.jpg'}')` }"></div>
|
<nuxt-link :to="`/bai-viet/${parseData.slug}`">
|
||||||
|
<div class="article_miss_thumb custom-thumb" :style="{ backgroundImage: `url('${parseData.thumbnail ? parseData.thumbnail : '/images/default-thumbnail.jpg'}')` }"></div>
|
||||||
|
</nuxt-link>
|
||||||
|
|
||||||
|
|
||||||
<div class="article_miss_content" :style="LAYOUT_PARSE['content']">
|
<div class="article_miss_content" :style="LAYOUT_PARSE['content']">
|
||||||
|
<nuxt-link :to="`/bai-viet/${parseData.slug}`">
|
||||||
|
|
||||||
<h3 class="line-clamp text-white" :class="LAYOUT_PARSE['title_Class']" :style="LAYOUT_PARSE['h3.title']">
|
<h3 class="line-clamp text-white" :class="LAYOUT_PARSE['title_Class']" :style="LAYOUT_PARSE['h3.title']">
|
||||||
{{ parseData.title?.replace(/<[^>]+>/g, "") }}
|
{{ parseData.title?.replace(/<[^>]+>/g, "") }}
|
||||||
</h3>
|
</h3>
|
||||||
|
</nuxt-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div v-else class="empty-box"></div>
|
<div v-else class="empty-box"></div>
|
||||||
|
|||||||
+2
-2
@@ -70,7 +70,7 @@ const mapActivesToItems = (index: number) => {
|
|||||||
<section :id="`cpn_${_props.component.id}`" class="gallery" :class="[LAYOUT_PARSE['div.collection-container_Class'], LAYOUT_PARSE['collection_Class']]" @click="selectComponent" :style="LAYOUT_PARSE['div.collection-container']">
|
<section :id="`cpn_${_props.component.id}`" class="gallery" :class="[LAYOUT_PARSE['div.collection-container_Class'], LAYOUT_PARSE['collection_Class']]" @click="selectComponent" :style="LAYOUT_PARSE['div.collection-container']">
|
||||||
<div class="wrap" v-for="(component, index) in _dataResult" :key="index">
|
<div class="wrap" v-for="(component, index) in _dataResult" :key="index">
|
||||||
<DynamicComponent
|
<DynamicComponent
|
||||||
class="abc"
|
class="box"
|
||||||
:settings="{
|
:settings="{
|
||||||
template: SETTING_OPTIONS.TEMPLATE,
|
template: SETTING_OPTIONS.TEMPLATE,
|
||||||
layout: SETTING_OPTIONS.LAYOUT,
|
layout: SETTING_OPTIONS.LAYOUT,
|
||||||
@@ -142,7 +142,7 @@ const mapActivesToItems = (index: number) => {
|
|||||||
padding-top: 241px;
|
padding-top: 241px;
|
||||||
}
|
}
|
||||||
|
|
||||||
& > .abc {
|
& > .box {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ const mapActivesToItems = (index: number) => {
|
|||||||
|
|
||||||
const currentCategoryTree = ref<any []>([]);
|
const currentCategoryTree = ref<any []>([]);
|
||||||
if(currentArticle.value?.categoryId) {
|
if(currentArticle.value?.categoryId) {
|
||||||
|
console.log('urrentArticle.value?.categoryId', categoryTree.value)
|
||||||
currentCategoryTree.value = findElementPathById(categoryTree.value, currentArticle.value.categoryId)
|
currentCategoryTree.value = findElementPathById(categoryTree.value, currentArticle.value.categoryId)
|
||||||
}
|
}
|
||||||
function findElementPathById(categories: any[], targetId: number, path: any[] = []) {
|
function findElementPathById(categories: any[], targetId: number, path: any[] = []) {
|
||||||
@@ -108,7 +109,7 @@ function findElementPathById(categories: any[], targetId: number, path: any[] =
|
|||||||
<div class="section_layout border-custom four_col_layout" :style="LAYOUT_PARSE['div.section_layout']">
|
<div class="section_layout border-custom four_col_layout" :style="LAYOUT_PARSE['div.section_layout']">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div>
|
<div>
|
||||||
<div class="audio">
|
<!-- <div class="audio">
|
||||||
<div class="play">
|
<div class="play">
|
||||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path
|
<path
|
||||||
@@ -124,7 +125,7 @@ function findElementPathById(categories: any[], targetId: number, path: any[] =
|
|||||||
<div class="timeline">
|
<div class="timeline">
|
||||||
<input type="range" name="" id="" />
|
<input type="range" name="" id="" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
|
|||||||
+2
-2
@@ -11,12 +11,12 @@ const store = reactive({
|
|||||||
});
|
});
|
||||||
//lấy danh sách categoryTree
|
//lấy danh sách categoryTree
|
||||||
await store.category.fetchBySiteId()
|
await store.category.fetchBySiteId()
|
||||||
const site = useCookie('site')
|
// const site = useCookie('site')
|
||||||
const { data } = await useAsyncData('index', () => store.dynamicPage.fetchPageByCode(route.path === '/' ? 'trang-chu' : route.path.replace('/', '')))
|
const { data } = await useAsyncData('index', () => store.dynamicPage.fetchPageByCode(route.path === '/' ? 'trang-chu' : route.path.replace('/', '')))
|
||||||
const asycnCurrentPage = data.value && data.value.currentPage;
|
const asycnCurrentPage = data.value && data.value.currentPage;
|
||||||
const asycnSectionPublished = data.value && data.value.sectionPublished;
|
const asycnSectionPublished = data.value && data.value.sectionPublished;
|
||||||
const asycnComponentPublished = data.value && data.value.componentPublished;
|
const asycnComponentPublished = data.value && data.value.componentPublished;
|
||||||
site.value = data.value?.currentPage?.siteId
|
// site.value = data.value?.currentPage?.siteId
|
||||||
useHead({
|
useHead({
|
||||||
title: () => 'Trang chủ',
|
title: () => 'Trang chủ',
|
||||||
description: () => 'Với công nghệ đột phá và giải pháp sáng tạo, Vpress sẽ là đối tác tin cậy của các tòa soạn báo, cùng nhau kiến tạo nên những giá trị bền vững trong kỷ nguyên chuyển đổi số báo chí.',
|
description: () => 'Với công nghệ đột phá và giải pháp sáng tạo, Vpress sẽ là đối tác tin cậy của các tòa soạn báo, cùng nhau kiến tạo nên những giá trị bền vững trong kỷ nguyên chuyển đổi số báo chí.',
|
||||||
|
|||||||
@@ -32,10 +32,11 @@ export const list = async (event : H3Event) => {
|
|||||||
try {
|
try {
|
||||||
const { site, apiUrl } = useRuntimeConfig().public;
|
const { site, apiUrl } = useRuntimeConfig().public;
|
||||||
const query = getQuery(event)
|
const query = getQuery(event)
|
||||||
const { items }: CategoryTree[] | any = await $fetch(`${apiUrl}/cms/category/tree/site:1`, {
|
const siteId = getSite(query.site).toString()
|
||||||
|
const { items }: CategoryTree[] | any = await $fetch(`${apiUrl}/cms/category/tree/site:${siteId}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
site: getSite(query.site).toString(),
|
site: siteId,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
return { items } ;
|
return { items } ;
|
||||||
|
|||||||
@@ -20,10 +20,11 @@ export type PollOption = {
|
|||||||
|
|
||||||
const { apiUrl } = useRuntimeConfig().public
|
const { apiUrl } = useRuntimeConfig().public
|
||||||
const { pollId }: any = getQuery(event)
|
const { pollId }: any = getQuery(event)
|
||||||
|
const query = getQuery(event)
|
||||||
const { items }: PollOption[] | any = await $fetch(`${apiUrl}/cms/poll-option/poll:${pollId}`, {
|
const { items }: PollOption[] | any = await $fetch(`${apiUrl}/cms/poll-option/poll:${pollId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
site: Number(useCookie('site').value)
|
site: getSite(query.site).toString()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,11 @@ export const create = async (event: H3Event) => {
|
|||||||
try {
|
try {
|
||||||
const { apiUrl } = useRuntimeConfig().public
|
const { apiUrl } = useRuntimeConfig().public
|
||||||
const payload = await readBody<any>(event)
|
const payload = await readBody<any>(event)
|
||||||
|
const query = getQuery(event)
|
||||||
const { item }: any = await $fetch(`${apiUrl}/cms/poll-response`, {
|
const { item }: any = await $fetch(`${apiUrl}/cms/poll-response`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
site: Number(useCookie('site').value)
|
site: getSite(query.site).toString()
|
||||||
},
|
},
|
||||||
body: payload
|
body: payload
|
||||||
})
|
})
|
||||||
@@ -35,10 +36,11 @@ export const fetchByPollId = async (event: H3Event) => {
|
|||||||
try {
|
try {
|
||||||
const { apiUrl } = useRuntimeConfig().public
|
const { apiUrl } = useRuntimeConfig().public
|
||||||
const { pollId }: any = getQuery(event)
|
const { pollId }: any = getQuery(event)
|
||||||
|
const query = getQuery(event)
|
||||||
const { items }: PollResponse[] | any = await $fetch(`${apiUrl}/cms/poll-response/poll:${pollId}`, {
|
const { items }: PollResponse[] | any = await $fetch(`${apiUrl}/cms/poll-response/poll:${pollId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
site: Number(useCookie('site').value)
|
site: getSite(query.site).toString()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,11 @@ export type Poll = {
|
|||||||
try {
|
try {
|
||||||
const { apiUrl } = useRuntimeConfig().public
|
const { apiUrl } = useRuntimeConfig().public
|
||||||
const { pollId}: any = getQuery(event)
|
const { pollId}: any = getQuery(event)
|
||||||
|
const query = getQuery(event)
|
||||||
const { item }: Poll | any = await $fetch(`${apiUrl}/cms/poll/${pollId}`, {
|
const { item }: Poll | any = await $fetch(`${apiUrl}/cms/poll/${pollId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
site: 1
|
site: getSite(query.site).toString()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,11 @@ export type Quiz = {
|
|||||||
|
|
||||||
const { apiUrl } = useRuntimeConfig().public
|
const { apiUrl } = useRuntimeConfig().public
|
||||||
const { quizId }: any = getQuery(event)
|
const { quizId }: any = getQuery(event)
|
||||||
|
const query = getQuery(event)
|
||||||
const { item }: Quiz | any = await $fetch(`${apiUrl}/cms/quiz/${quizId}`, {
|
const { item }: Quiz | any = await $fetch(`${apiUrl}/cms/quiz/${quizId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
site: 1
|
site: getSite(query.site).toString()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,11 @@ export type Survey = {
|
|||||||
|
|
||||||
const { apiUrl } = useRuntimeConfig().public
|
const { apiUrl } = useRuntimeConfig().public
|
||||||
const { surveyId }: any = getQuery(event)
|
const { surveyId }: any = getQuery(event)
|
||||||
|
const query = getQuery(event)
|
||||||
const { item }: Survey | any = await $fetch(`${apiUrl}/cms/survey/${surveyId}`, {
|
const { item }: Survey | any = await $fetch(`${apiUrl}/cms/survey/${surveyId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
site: 1
|
site: getSite(query.site).toString()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ export const get = async(event: H3Event) => {
|
|||||||
try {
|
try {
|
||||||
const { apiUrl } = useRuntimeConfig().public
|
const { apiUrl } = useRuntimeConfig().public
|
||||||
const { code } = getQuery(event)
|
const { code } = getQuery(event)
|
||||||
|
const query = getQuery(event)
|
||||||
const { items }: any = await $fetch(`${apiUrl}/cms/tag/code:${code}`, {
|
const { items }: any = await $fetch(`${apiUrl}/cms/tag/code:${code}`, {
|
||||||
headers: {
|
headers: {
|
||||||
site: 1
|
site: getSite(query.site).toString()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return items
|
return items
|
||||||
@@ -23,10 +23,11 @@ export const fetchById = async(event: H3Event) => {
|
|||||||
try {
|
try {
|
||||||
const { apiUrl } = useRuntimeConfig().public
|
const { apiUrl } = useRuntimeConfig().public
|
||||||
const { tagId }: any = getQuery(event)
|
const { tagId }: any = getQuery(event)
|
||||||
|
const query = getQuery(event)
|
||||||
const { item }: any = await $fetch(`${apiUrl}/cms/tag/${tagId}`, {
|
const { item }: any = await $fetch(`${apiUrl}/cms/tag/${tagId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Site: 1
|
Site: getSite(query.site).toString()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return item
|
return item
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ export const listPaging = async (event: H3Event) => {
|
|||||||
if(categoryId) {
|
if(categoryId) {
|
||||||
query.value = { categoryId }
|
query.value = { categoryId }
|
||||||
}
|
}
|
||||||
|
const gQuery = getQuery(event)
|
||||||
const { items, total }: any = await $fetch(`${apiUrl}/cms/topic/condition/paging:${page}-${limit}/sorting:${sort}`,{
|
const { items, total }: any = await $fetch(`${apiUrl}/cms/topic/condition/paging:${page}-${limit}/sorting:${sort}`,{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {site: 1},
|
headers: {site: getSite(gQuery.site).toString()},
|
||||||
body:{ ...query.value }
|
body:{ ...query.value }
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -29,10 +29,11 @@ export const fetchByCode = async(event: H3Event) => {
|
|||||||
try {
|
try {
|
||||||
const { apiUrl } = useRuntimeConfig().public
|
const { apiUrl } = useRuntimeConfig().public
|
||||||
const { topicCode }: any = getQuery(event)
|
const { topicCode }: any = getQuery(event)
|
||||||
|
const query = getQuery(event)
|
||||||
const { item }: any = await $fetch(`${apiUrl}/cms/topic/code:${topicCode}`, {
|
const { item }: any = await $fetch(`${apiUrl}/cms/topic/code:${topicCode}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
site: 1
|
site: getSite(query.site).toString()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -46,10 +47,11 @@ export const fetchById = async(event: H3Event) => {
|
|||||||
try {
|
try {
|
||||||
const { apiUrl } = useRuntimeConfig().public
|
const { apiUrl } = useRuntimeConfig().public
|
||||||
const { topicId }: any = getQuery(event)
|
const { topicId }: any = getQuery(event)
|
||||||
|
const query = getQuery(event)
|
||||||
const { item }: any = await $fetch(`${apiUrl}/cms/topic/${topicId}`, {
|
const { item }: any = await $fetch(`${apiUrl}/cms/topic/${topicId}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
site: 1
|
site: getSite(query.site).toString()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
export const getSite = (dns : any) => {
|
export const getSite = (dns : any) => {
|
||||||
const SITE = {
|
const SITE = {
|
||||||
DEFAULT: 1,
|
DEFAULT: 1,
|
||||||
KINHTEDOTHI: 'kinhtedothi',
|
PORTAL2: 'portal2',
|
||||||
}
|
}
|
||||||
|
|
||||||
let site = null;
|
let site = null;
|
||||||
switch (dns) {
|
switch (dns) {
|
||||||
case SITE.KINHTEDOTHI:
|
case SITE.PORTAL2:
|
||||||
site = 2;
|
site = 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
+7
-2
@@ -83,9 +83,14 @@ import type { Category, CategoryTree } from "~/server/models/category";
|
|||||||
export const useCategoryStore = defineStore('usecategorystore', () => {
|
export const useCategoryStore = defineStore('usecategorystore', () => {
|
||||||
const categoryTree = shallowRef<CategoryTree[]>([])
|
const categoryTree = shallowRef<CategoryTree[]>([])
|
||||||
const currentCategoryTree = shallowRef<any[]>([])
|
const currentCategoryTree = shallowRef<any[]>([])
|
||||||
|
const url : any = useRequestURL();
|
||||||
|
const host = url.hostname.split('.')[0];
|
||||||
async function fetchBySiteId() {
|
async function fetchBySiteId() {
|
||||||
const { data }: any = await useFetch(`/api/services/category-tree`)
|
const { data }: any = await useFetch(`/api/services/category-tree`,{
|
||||||
|
query: {
|
||||||
|
site: host
|
||||||
|
}
|
||||||
|
})
|
||||||
categoryTree.value = data.value.items
|
categoryTree.value = data.value.items
|
||||||
return categoryTree.value
|
return categoryTree.value
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ import type { PollOption } from "~/server/models/poll-option"
|
|||||||
export const usePollOptionStore = defineStore('usePollOptionStore', () => {
|
export const usePollOptionStore = defineStore('usePollOptionStore', () => {
|
||||||
const currentPollOption = shallowReactive<PollOption>({})
|
const currentPollOption = shallowReactive<PollOption>({})
|
||||||
const currentPollOptions = shallowRef<PollOption[] | any[]>([])
|
const currentPollOptions = shallowRef<PollOption[] | any[]>([])
|
||||||
|
const url : any = useRequestURL();
|
||||||
|
const host = url.hostname.split('.')[0];
|
||||||
async function fetchByPollId(id: string) {
|
async function fetchByPollId(id: string) {
|
||||||
try {
|
try {
|
||||||
const { data } = await useFetch<any>(`/api/services/poll-option/pollId`, {
|
const { data } = await useFetch<any>(`/api/services/poll-option/pollId`, {
|
||||||
query: {
|
query: {
|
||||||
pollId: id
|
pollId: id,
|
||||||
|
site: host
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ import type { PollResponse } from "~/server/models/poll-response"
|
|||||||
export const usePollResponseStore = defineStore('usePollResponseStore', () => {
|
export const usePollResponseStore = defineStore('usePollResponseStore', () => {
|
||||||
const currentPollResponse = shallowReactive<PollResponse>({})
|
const currentPollResponse = shallowReactive<PollResponse>({})
|
||||||
const currentPollResponses = shallowRef<PollResponse[]>([])
|
const currentPollResponses = shallowRef<PollResponse[]>([])
|
||||||
|
const url : any = useRequestURL();
|
||||||
|
const host = url.hostname.split('.')[0];
|
||||||
const create = async (pollResponse: any) => {
|
const create = async (pollResponse: any) => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await useFetch<any>(`/api/services/poll-response`, {
|
const { data } = await useFetch<any>(`/api/services/poll-response`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: pollResponse
|
body: pollResponse,
|
||||||
|
query: {site: host}
|
||||||
})
|
})
|
||||||
data.value && (Object.assign(currentPollResponse, data.value))
|
data.value && (Object.assign(currentPollResponse, data.value))
|
||||||
return currentPollResponse
|
return currentPollResponse
|
||||||
@@ -21,7 +24,8 @@ export const usePollResponseStore = defineStore('usePollResponseStore', () => {
|
|||||||
try {
|
try {
|
||||||
const { data } = await useFetch<any>(`/api/services/poll-response/pollId`, {
|
const { data } = await useFetch<any>(`/api/services/poll-response/pollId`, {
|
||||||
query: {
|
query: {
|
||||||
pollId: id
|
pollId: id,
|
||||||
|
site: host
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
+7
-11
@@ -1,12 +1,17 @@
|
|||||||
import type { Poll } from "~/server/models/poll"
|
import type { Poll } from "~/server/models/poll"
|
||||||
export const usePollStore = defineStore('usePollStore', () => {
|
export const usePollStore = defineStore('usePollStore', () => {
|
||||||
const currentPoll = shallowReactive<Poll>({})
|
const currentPoll = shallowReactive<Poll>({})
|
||||||
|
|
||||||
|
const url : any = useRequestURL();
|
||||||
|
const host = url.hostname.split('.')[0];
|
||||||
|
|
||||||
async function fetchById(id: string) {
|
async function fetchById(id: string) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await useFetch<any>(`/api/services/poll-by-id`, {
|
const { data } = await useFetch<any>(`/api/services/poll-by-id`, {
|
||||||
query: {
|
query: {
|
||||||
pollId: id
|
pollId: id,
|
||||||
|
site: host
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -16,16 +21,7 @@ export const usePollStore = defineStore('usePollStore', () => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return { fetchById, currentPoll }
|
||||||
async function categoryId() {
|
|
||||||
try {
|
|
||||||
const { data } = await useFetch(`/api/services/category-tree`)
|
|
||||||
return data.value
|
|
||||||
} catch (error) {}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return { fetchById, currentPoll, categoryId }
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if(import.meta.hot) {
|
if(import.meta.hot) {
|
||||||
|
|||||||
Reference in New Issue
Block a user