diff --git a/src/pages/web/[name]/[id].vue b/src/pages/web/[name]/[id].vue index bf151ad..9ee9cb4 100644 --- a/src/pages/web/[name]/[id].vue +++ b/src/pages/web/[name]/[id].vue @@ -12,8 +12,6 @@ const site_id = ref(); const site_logo = ref(); const site_name = ref(); const pages = ref([]); -const pallete_id = ref(); -const pallete = ref([]); const loading = ref(true); onBeforeMount(() => { console.log(id); @@ -23,70 +21,42 @@ const loading = ref(true); async function initialize() { getSite(); layout.value = "left"; - (await get)(`/create_site/pages/${id}`).then((res:any) => { + (await get)(`/sitepages/${id}`).then((res:any) => { console.log(res.data); if (res.data) { page_title.value = res.data.page_name; page_content.value = res.data.content; site_id.value = res.data.site; images.value = res.data.image + layout.value=res.data.layout; getPages(); - console.log(page_content.value); - getLayout(); + loading.value = false; } }); } const getSite = async () =>{ - (await get)(`/create_site/sites/show/${route.params.name}`).then((res) => { + (await get)(`/site/name/${route.params.name}`).then((res) => { console.log(res.data); site_id.value = res.data.id; + layout.value = res.data.layout; + site_logo.value = res.data.logo_path; + site_name.value = res.data.site_name; }); } async function getPages() { try { - (await get)("/create_site/pages/", { site: id }).then((res:any) => { + (await get)("/pages/site", { site: site_id.value }).then((res:any) => { + console.log("pages:"); console.log(res.data); - res.data.forEach((element: any) => { - if (element.site == site_id.value) { - pages.value.push(element); - } - }); - pages.value = pages.value.reverse(); - + pages.value=res.data; + pages.value = pages.value.reverse(); }); } catch (error) { // Handle errors here console.error(error); } } -async function getLayout() { - (await get)(`/create_site/sites/${site_id.value}`).then((res:any) => { - console.log(res.data); - if (res.data) { - layout.value = res.data.layout; - site_logo.value = res.data.logo_path; - site_name.value = res.data.site_name; - pallete_id.value = res.data.color_swatch; - get(`/create_site/company/${res.data.company}`).then((res:any) => { - console.log(res.data); - if (res.data) { - site_logo.value = res.data.logo_path; - get(`/color_swatches/`).then((res) => { - res.data.forEach((element: any) => { - if (element.id == pallete_id.value) { - loading.value = false; - pallete.value = element; - console.log(pallete.value); - } - }); - }); - } - }); - console.log(page_content.value); - } - }); -} const unescapedPageContent = computed(() => { const parser = new DOMParser(); @@ -127,7 +97,7 @@ const unescapedPageContent = computed(() => {