diff --git a/.env b/.env index 25f5e16..ec188ed 100644 --- a/.env +++ b/.env @@ -2,5 +2,6 @@ VITE_API_URL='https://ssa.betadelivery.com/apia/v1' # VITE_API_URL='http://192.16.50.44/seo-backend/apia/v1' VITE_USER_NAME="Admin" VITE_PASSWORD="71%@L%es^bUX94`J9XT*@bh,._WWM{$%^^&&" +# VITE_PASSWORD="71%@L%es^bUX94`J9XT*%4&^%tUU^%Q^ffgt" VITE_APP_NAME=MyViteApp VITE_IMG_TEMPLATES='https://ssa.betadelivery.com/storage/app/public/uploads/post_templates/' \ No newline at end of file diff --git a/.env.testing b/.env.testing index 7e0b93a..03891f6 100644 --- a/.env.testing +++ b/.env.testing @@ -1,5 +1,5 @@ -VITE_API_URL='https://ssa.betadelivery.com/testing/apia/' -VITE_USER_NAME="Admin" -VITE_PASSWORD="71%@L%es^bUX94`J9XT*@bh,._WWM{$%^^&&" -VITE_APP_NAME=MyViteApp -VITE_IMG_TEMPLATES='https://ssa.betadelivery.com/storage/app/public/uploads/post_templates/' +# VITE_API_URL='https://ssa.betadelivery.com/testing/apia/' +# VITE_USER_NAME="Admin" +# VITE_PASSWORD="71%@L%es^bUX94`J9XT*@bh,._WWM{$%^^&&" +# VITE_APP_NAME=MyViteApp +# VITE_IMG_TEMPLATES='https://ssa.betadelivery.com/storage/app/public/uploads/post_templates/' diff --git a/dev-dist/sw.js b/dev-dist/sw.js index 2e18a22..ec4592f 100644 --- a/dev-dist/sw.js +++ b/dev-dist/sw.js @@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict'; "revision": "3ca0b8505b4bec776b69afdba2768812" }, { "url": "index.html", - "revision": "0.f0vgku9v39o" + "revision": "0.cuug5u5p6eo" }], {}); workbox.cleanupOutdatedCaches(); workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { diff --git a/src/Pages/Login.tsx b/src/Pages/Login.tsx index 8a749ef..7463dc4 100644 --- a/src/Pages/Login.tsx +++ b/src/Pages/Login.tsx @@ -46,7 +46,8 @@ const Login = () => { // Encode Basic Auth Credentials const username = import.meta.env.VITE_USER_NAME || ""; // Replace with actual username const password = import.meta.env.VITE_PASSWORD || ""; // Replace with actual password - const basicAuth = `${username} : ${password}`; // Encode to Base64 + const credentials = `${username}:${password}`; // Encode to Base64 + const basicAuth = btoa(credentials); try { const res = await axios.post( @@ -77,18 +78,22 @@ const Login = () => { console.log(res); console.log("===================================="); } - } catch (error) { - console.log('error', error); + } catch (error: any) { + console.log('error', error?.response); - if (error) { + if (axios.isAxiosError(error) && error.response) { + toaster.create({ + title: error.response.data?.message, + // title: "Something Went Wrong", + type: "info", + }); + } else { toaster.create({ - // title: error?.response?.data?.message, title: "Something Went Wrong", type: "info", - }) - // console.log("Login failed", error?.response?.data?.message); - setIsLoading(false); + }); } + setIsLoading(false); } }); diff --git a/src/Pages/ManageCMS/FAQ/FAQ.tsx b/src/Pages/ManageCMS/FAQ/FAQ.tsx index 110a895..7878e46 100644 --- a/src/Pages/ManageCMS/FAQ/FAQ.tsx +++ b/src/Pages/ManageCMS/FAQ/FAQ.tsx @@ -60,11 +60,11 @@ const FAQ = () => { const [deleteModal, setDeleteModal] = useState(false) const [selectedFaqId, setSelectedFaqId] = useState(null); - // console.log('DATA', data?.data); + console.log('DATA', data?.data.data); useEffect(() => { - if (data?.data) { - setLocalData(data?.data); + if (data) { + setLocalData(data?.data.data); } }, [data]); @@ -114,48 +114,53 @@ const FAQ = () => { const filteredData = localData?.filter((agency) => - agency.question.toLowerCase().includes(searchTerm.toLowerCase()) - ); + agency.translations.map((translation: any) => translation.question.toLowerCase()).some((question: string) => + question.includes(searchTerm.toLowerCase()) + )) - const managepost = filteredData?.map((agency: FaqData, index: number) => ({ - 'id': agency.id, - "Sr. No": index + 1, - "Question": agency.question, - "Answer": agency.answer, + console.log("filteredData", filteredData); + - "Action": ( - - + const managepost = filteredData?.map((agency: FaqData, index: number) => + agency.translations.map((translation: any) => ({ + 'id': agency.id, + "Sr. No": index + 1, + "Question": translation.question, + "Answer": translation.answer, - { - setSelectedFaqId(agency.id); - setDeleteModal(true) - }} />} - alertText="Delete FAQ" - alertIcon={} - alertCaption="are you sure you want to delete ?" - onClose={() => setDeleteModal(false)} - onConfirm={() => { - // console.log("Deleting FAQ with ID:", selectedFaqId); // Correct ID - if (selectedFaqId) { - setDeleteModal(false); - handleDeleteFaq(selectedFaqId); - } - }} - /> - - handleToggle(agency.id.toString(), Number(agency.is_active))} - checked={Boolean(Number(agency.is_active))} + "Action": ( + + + + { + setSelectedFaqId(agency.id); + setDeleteModal(true) + }} />} + alertText="Delete FAQ" + alertIcon={} + alertCaption="are you sure you want to delete ?" + onClose={() => setDeleteModal(false)} + onConfirm={() => { + // console.log("Deleting FAQ with ID:", selectedFaqId); // Correct ID + if (selectedFaqId) { + setDeleteModal(false); + handleDeleteFaq(selectedFaqId); + } + }} /> - - - ), - })); + + handleToggle(agency.id.toString(), Number(agency.is_active))} + checked={Boolean(Number(agency.is_active))} + /> + + + ), + }))) // if (!isLoading && !data?.data) { // return ( diff --git a/src/Redux/Service/faqs.service.ts b/src/Redux/Service/faqs.service.ts index 1c59041..db50fd9 100644 --- a/src/Redux/Service/faqs.service.ts +++ b/src/Redux/Service/faqs.service.ts @@ -1,27 +1,26 @@ import { createApi } from "@reduxjs/toolkit/query/react"; import { baseQueryWithReauth } from "./apiSlice"; -interface Faq { +export interface FaqData { id: number; principal_type_xid: number; is_active: string; -} - -export interface FaqData { - id: number; - faqs_xid: number; - language_master_xid: number; - question: string; - answer: string; - is_active: string; - faq: Faq; + translations:{ + id: string, + faqs_xid: number, + language_master_xid: number, + question: string, + answer: string, + }[] } interface ApiResponse { status: string; status_code: number; message: string; - data: FaqData[]; + data: { + data: FaqData[]; + }; }