diff --git a/dev-dist/sw.js b/dev-dist/sw.js index ec4592f..69b4925 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.cuug5u5p6eo" + "revision": "0.4sre1e6vpfo" }], {}); workbox.cleanupOutdatedCaches(); workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { diff --git a/src/Pages/ForgotPassword.tsx b/src/Pages/ForgotPassword.tsx index 0a3233d..449da3e 100644 --- a/src/Pages/ForgotPassword.tsx +++ b/src/Pages/ForgotPassword.tsx @@ -31,6 +31,10 @@ const ForgotPassword = () => { } = useForm(); const onSubmit = handleSubmit(async (data) => { + 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 + setIsLoading(true); try { const res = await axios.post( @@ -38,12 +42,24 @@ const ForgotPassword = () => { { mobile_number: Number(data.mobileNumber), }, + { + headers: { + Authorization: `Basic ${basicAuth}`, + "Content-Type": "application/json", + }, + } ); if (res.status === 200) { navigate(`/forgot-password/verify?phone=${data.mobileNumber}`) } else { - alert(res.data.message || "Something went wrong"); + // alert(res.data.message || "Something went wrong"); + toaster.create({ + // title: error?.response?.data?.message, + title: res.data.message || "Something went wrong", + type: "error", + }) + setIsLoading(false); } console.log("============", res); diff --git a/src/Pages/Login.tsx b/src/Pages/Login.tsx index 7463dc4..a023088 100644 --- a/src/Pages/Login.tsx +++ b/src/Pages/Login.tsx @@ -46,8 +46,7 @@ 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 credentials = `${username}:${password}`; // Encode to Base64 - const basicAuth = btoa(credentials); + const basicAuth = `${username}:${password}`; // Encode to Base64 try { const res = await axios.post( @@ -78,22 +77,18 @@ const Login = () => { console.log(res); console.log("===================================="); } - } catch (error: any) { - console.log('error', error?.response); + } catch (error) { + console.log('error', error); - if (axios.isAxiosError(error) && error.response) { - toaster.create({ - title: error.response.data?.message, - // title: "Something Went Wrong", - type: "info", - }); - } else { + if (error) { 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/EditDetails.tsx b/src/Pages/ManageCMS/FAQ/EditDetails.tsx index 18d0c08..2864c95 100644 --- a/src/Pages/ManageCMS/FAQ/EditDetails.tsx +++ b/src/Pages/ManageCMS/FAQ/EditDetails.tsx @@ -1,85 +1,3 @@ -// import { Button } from "../../../components/ui/button"; -// import { -// DialogBody, -// DialogCloseTrigger, -// DialogContent, -// DialogFooter, -// DialogHeader, -// DialogRoot, -// DialogTitle, -// DialogTrigger, -// } from "../../../components/ui/dialog"; -// import { Field, Input, Stack, Textarea } from "@chakra-ui/react"; -// import Edit from "../../../components/ActionIcons/Edit"; -// function EditDetails() { -// return ( -// -// -// {/* */} -// - -// - -// -// -// -// Edit Details -// -// - -// -// -// -// -// Questions -// -// - -// -// Answer -// -//