From 45cb5f470ced79f2e218691ab243115ce2986bb7 Mon Sep 17 00:00:00 2001 From: ehsan vaseghi Date: Sat, 13 Apr 2024 16:24:00 +0330 Subject: [PATCH] 4 --- src/pages/web/[name]/[id].vue | 78 +++++---------- src/pages/web/[name]/index.vue | 167 +++++---------------------------- 2 files changed, 50 insertions(+), 195 deletions(-) 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(() => {