diff --git a/src/component/product/ProductActive.jsx b/src/component/product/ProductActive.jsx index a5416f6..cbcd297 100644 --- a/src/component/product/ProductActive.jsx +++ b/src/component/product/ProductActive.jsx @@ -1,19 +1,44 @@ -import React from "react"; +import React, { useRef } from "react"; import getImage from "../../utils/getImage"; import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS"; import GeneralTab from "./settingsTab/GeneralTab"; +import { useMutation } from "@tanstack/react-query"; +import { productRefreshSite } from "../../services/services"; export default function ProductActive({productData}){ - const settingsObject = { - home_tab: { title: 'Home Page', controls: 'home', active: 'active show' , data: {}}, - footer_tab: { title: 'Footer', controls: 'footer', active: '', data: {} }, - about_tab: { title: 'About Page', controls: 'about', active: '', data: {} }, - contact_tab: { title: 'Contact Page', controls: 'contact', active: '', data: {} }, - social_tab: { title: 'Socials', controls: 'social', active: '', data: {} }, - template_tab: { title: 'Template', controls: 'template', active: '', data: {} }, - color_scheme_tab: { title: 'Color Scheme', controls: 'color-scheme', active: '', data: {} }, - }; + const iframe = useRef() + + const settingsObject = { + home_tab: { title: 'Home Page', controls: 'home', active: 'active show' , data: {}}, + footer_tab: { title: 'Footer', controls: 'footer', active: '', data: {} }, + about_tab: { title: 'About Page', controls: 'about', active: '', data: {} }, + contact_tab: { title: 'Contact Page', controls: 'contact', active: '', data: {} }, + social_tab: { title: 'Socials', controls: 'social', active: '', data: {} }, + template_tab: { title: 'Template', controls: 'template', active: '', data: {} }, + color_scheme_tab: { title: 'Color Scheme', controls: 'color-scheme', active: '', data: {} }, + }; + + const refresh = useMutation({ + mutationFn: (fields) => { + return productRefreshSite(fields) + }, + onSuccess: (res) => { + iframe.current.src += '' + } + }) + + const handleRefresh = () => { + const reqData = { + token: localStorage.getItem('token'), // USER TOKEN + uid: localStorage.getItem('uid'), // USER UID + product_id: productData.product_id, + subscription_uid: productData.subscription_uid + + } + refresh.mutate(reqData) + } + let externalUrl= 'https://'+productData?.internal_url return( <> @@ -24,74 +49,66 @@ export default function ProductActive({productData}){
-<> - - -
-
-
-
-
-

{productData?.internal_url ? productData?.internal_url : 'https://25681.devprov.mermsemr.com/'}

-
-
-
- - -
-
-
-
-
-
-
-

Site Settings

-
-
-
-
-
    - <> - {Object.entries(settingsObject).map(([key, value]) => ( -
  • - {value.title} -
  • - ))} - -
-
- <> - {Object.entries(settingsObject).map(([key, value]) => ( -
- + <> +
+
+
+
+
+

{externalUrl}

+
- ))} - +
+
+ +
+
+ +
+
+
+
+
+
+
+

Site Settings

+
+
+
+
+
    + <> + {Object.entries(settingsObject).map(([key, value]) => ( +
  • + {value.title} +
  • + ))} + +
+
+ <> + {Object.entries(settingsObject).map(([key, value]) => ( +
+ +
+ ))} + +
+
+
+
-
+
-
-
- - - - - - - - - - -
- ) } \ No newline at end of file diff --git a/src/services/services.js b/src/services/services.js index 1a61f98..cc899cc 100644 --- a/src/services/services.js +++ b/src/services/services.js @@ -115,6 +115,14 @@ export const productsData = (reqData) => { return postAuxEnd(`/panel/account/products`, postData, false) } +// FUNCTION TO REFRESH SITE +export const productRefreshSite = (reqData) => { + let postData = { + ...reqData, + } + return postAuxEnd(`/panel/account/products/refresh`, postData, false) +} + // FUNCTION TO GET DASHBOARD RECENT ACTIONS SECTION export const recentActions = (reqData) => { let postData = {