diff --git a/src/_nav.js b/src/_nav.js
index 1878fbf..ce19d4e 100644
--- a/src/_nav.js
+++ b/src/_nav.js
@@ -192,7 +192,7 @@ const _nav = [
// },
{
component: CNavGroup,
- name: "Website Related",
+ name: "Website Settings",
icon: ,
group: "",
@@ -202,28 +202,28 @@ const _nav = [
name: "Banner",
icon: ,
to: "/banner",
- group: "Website Related",
+ group: "Website Settings",
},
{
component: CNavItem,
name: "Register Image",
icon: ,
to: "/registerImage",
- group: "Website Related",
+ group: "Website Settings",
},
{
component: CNavItem,
name: "Login Image",
icon: ,
to: "/loginImage",
- group: "Website Related",
+ group: "Website Settings",
},
{
component: CNavItem,
name: "Shop Page Image",
icon: ,
to: "/shopImage",
- group: "Website Related",
+ group: "Website Settings",
},
// {
// component: CNavItem,
@@ -253,15 +253,15 @@ const _nav = [
name: "Content ",
icon: ,
to: "/content",
- group: "Website Related",
- },
- {
- component: CNavItem,
- name: "Home",
- icon: ,
- to: "/home",
- group: "Website Related",
+ group: "Website Settings",
},
+ // {
+ // component: CNavItem,
+ // name: "Home",
+ // icon: ,
+ // to: "/home",
+ // group: "Website Settings",
+ // },
],
},
{
diff --git a/src/views/Content/editAboutUs.js b/src/views/Content/editAboutUs.js
index c402162..6d944a9 100644
--- a/src/views/Content/editAboutUs.js
+++ b/src/views/Content/editAboutUs.js
@@ -5,158 +5,157 @@ import ReactQuill from "react-quill";
import "react-quill/dist/quill.snow.css";
import axios from "axios";
import { isAutheticated } from "src/auth";
+import { Link } from "react-router-dom";
const TOOLBAR_OPTIONS = [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ font: [] }],
[{ list: "ordered" }, { list: "bullet" }],
- ["bold", "italic", "underline", "strike"],
+ ["bold", "italic", "underline", "strike"],
[{ color: [] }, { background: [] }],
[{ align: [] }],
- [{ script: "super" }, { script: "sub" }],
- ["undo", "redo"],
+ [{ script: "super" }, { script: "sub" }],
+ ["undo", "redo"],
];
export default function EditAboutUs() {
- const [title, setTitle] = useState("About Us");
- const [content, setContent] = useState("");
- const [added, setAdded] = useState(false);
- const [olderContent, setOlderContent] = useState("");
- const [id, setId] = useState(null);
-
- const token = isAutheticated();
- const handleContentChange = (content, delta, source, editor) => {
- setContent(editor.getHTML());
- };
- const getAboutUs = async () => {
- const response = await axios.get("/api/content/about-us", {
+ const [title, setTitle] = useState("About Us");
+ const [content, setContent] = useState("");
+ const [added, setAdded] = useState(false);
+ const [olderContent, setOlderContent] = useState("");
+ const [id, setId] = useState(null);
+
+ const token = isAutheticated();
+ const handleContentChange = (content, delta, source, editor) => {
+ setContent(editor.getHTML());
+ };
+ const getAboutUs = async () => {
+ const response = await axios.get("/api/content/about-us", {
+ headers: {
+ Authorization: `Bearer ${token}`,
+ },
+ });
+ if (response.status === 200) {
+ setContent(response?.data?.aboutUs[0]?.aboutUsContent);
+ setId(response?.data?.aboutUs[0]?._id);
+ setOlderContent(response?.data?.aboutUs[0]?.aboutUsContent);
+ }
+ };
+
+ const addAboutUs = async () => {
+ const response = await axios.post(
+ "/api/content/about-us",
+ { content },
+ {
headers: {
Authorization: `Bearer ${token}`,
},
- });
- if (response.status === 200) {
-
- setContent(response?.data?.aboutUs[0]?.aboutUsContent);
- setId(response?.data?.aboutUs[0]?._id);
- setOlderContent(
- response?.data?.aboutUs[0]?.aboutUsContent
- );
}
- };
-
- const addAboutUs = async () => {
- const response = await axios.post(
- "/api/content/about-us",
- { content },
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- if (response.status == 201) {
- swal({
- title: "Congratulations!!",
- text: "About us added successfully!",
- icon: "success",
- button: "OK",
- });
- }
- };
- const handleCancelClick = () => {
- setContent(olderContent);
- };
- const updateContent = async () => {
- const response = await axios.patch(
- "/api/content/about-us-update",
- { content },
- {
- params: { id: id },
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
-
- );
- if (response.status === 200) {
- swal({
- title: "Congratulations!",
- text: "About Us updated successfully!",
- icon: "success",
- button: "OK",
- });
- } else {
- swal({
- title: "Sorry, please try again",
- text: "Something went wrong!",
- icon: "error",
- button: "Retry",
- dangerMode: true,
- });
- }
- };
- const handleSaveClick = async () => {
- if (olderContent === undefined && olderContent.length===0) {
- await addAboutUs();
- setAdded(true);
- } else {
- setAdded(false);
- await updateContent();
- }
- // // Reload terms and conditions
- // await getAboutUs();
- };
- useEffect(() => {
- // addTermsandConditions();
- getAboutUs();
- }, [added]);
- return (
-
-
-
-
-
-
-
-
- {" "}
- {title} :{" "}
-
- Body
-
-
-
);
- }
\ No newline at end of file
+ if (response.status == 201) {
+ swal({
+ title: "Congratulations!!",
+ text: "About us added successfully!",
+ icon: "success",
+ button: "OK",
+ });
+ }
+ };
+ const handleCancelClick = () => {
+ setContent(olderContent);
+ };
+ const updateContent = async () => {
+ const response = await axios.patch(
+ "/api/content/about-us-update",
+ { content },
+ {
+ params: { id: id },
+ headers: {
+ Authorization: `Bearer ${token}`,
+ },
+ }
+ );
+ if (response.status === 200) {
+ swal({
+ title: "Congratulations!",
+ text: "About Us updated successfully!",
+ icon: "success",
+ button: "OK",
+ });
+ } else {
+ swal({
+ title: "Sorry, please try again",
+ text: "Something went wrong!",
+ icon: "error",
+ button: "Retry",
+ dangerMode: true,
+ });
+ }
+ };
+ const handleSaveClick = async () => {
+ if (olderContent === undefined || olderContent === "") {
+ await addAboutUs();
+ setAdded(true);
+ } else {
+ setAdded(false);
+ await updateContent();
+ }
+ // // Reload terms and conditions
+ // await getAboutUs();
+ };
+ useEffect(() => {
+ // addTermsandConditions();
+ getAboutUs();
+ }, [added]);
+ return (
+
+
+
+
+
+
+
+
+
+
+ {" "}
+ {title} :{" "}
+
+ Body
+
+
+
+ );
+}
diff --git a/src/views/Content/editPrivacyPolicy.js b/src/views/Content/editPrivacyPolicy.js
index e6295e2..d7648fd 100644
--- a/src/views/Content/editPrivacyPolicy.js
+++ b/src/views/Content/editPrivacyPolicy.js
@@ -5,16 +5,17 @@ import ReactQuill from "react-quill";
import "react-quill/dist/quill.snow.css";
import axios from "axios";
import { isAutheticated } from "src/auth";
+import { Link } from "react-router-dom";
const TOOLBAR_OPTIONS = [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ font: [] }],
[{ list: "ordered" }, { list: "bullet" }],
- ["bold", "italic", "underline", "strike"],
+ ["bold", "italic", "underline", "strike"],
[{ color: [] }, { background: [] }],
[{ align: [] }],
- [{ script: "super" }, { script: "sub" }],
- ["undo", "redo"],
+ [{ script: "super" }, { script: "sub" }],
+ ["undo", "redo"],
];
export default function EditPrivacyPolicy() {
@@ -71,12 +72,11 @@ export default function EditPrivacyPolicy() {
"/api/content/privacy-and-policy-update",
{ content },
{
- params: { id: id },
+ params: { id: id },
headers: {
Authorization: `Bearer ${token}`,
},
}
-
);
if (response.status === 200) {
swal({
@@ -96,7 +96,7 @@ export default function EditPrivacyPolicy() {
}
};
const handleSaveClick = async () => {
- if (olderContent.length===0) {
+ if (olderContent === undefined || olderContent === "") {
await addPrivacyPolicy();
setAdded(true);
} else {
@@ -126,19 +126,21 @@ export default function EditPrivacyPolicy() {
>
Save
-
+
+
+
diff --git a/src/views/Content/editRefundPolicy.js b/src/views/Content/editRefundPolicy.js
index c8cca24..3873f95 100644
--- a/src/views/Content/editRefundPolicy.js
+++ b/src/views/Content/editRefundPolicy.js
@@ -6,17 +6,17 @@ import ReactQuill from "react-quill";
import "react-quill/dist/quill.snow.css";
import axios from "axios";
import { isAutheticated } from "src/auth";
-import { useNavigate, useNavigation } from "react-router-dom";
+import { Link, useNavigate, useNavigation } from "react-router-dom";
const TOOLBAR_OPTIONS = [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ font: [] }],
[{ list: "ordered" }, { list: "bullet" }],
- ["bold", "italic", "underline", "strike"],
+ ["bold", "italic", "underline", "strike"],
[{ color: [] }, { background: [] }],
[{ align: [] }],
- [{ script: "super" }, { script: "sub" }],
- ["undo", "redo"],
+ [{ script: "super" }, { script: "sub" }],
+ ["undo", "redo"],
];
export default function editRefundPolicy() {
@@ -24,8 +24,7 @@ export default function editRefundPolicy() {
const [content, setContent] = useState("");
const [added, setAdded] = useState(false);
const [olderContent, setOlderContent] = useState("");
- const [id, setId] = useState(null)
-
+ const [id, setId] = useState(null);
const token = isAutheticated();
const handleContentChange = (content, delta, source, editor) => {
@@ -72,12 +71,11 @@ export default function editRefundPolicy() {
"/api/content/refund-policy-update",
{ content },
{
- params: { id: id },
+ params: { id: id },
headers: {
Authorization: `Bearer ${token}`,
},
}
-
);
if (response.status === 200) {
swal({
@@ -97,7 +95,7 @@ export default function editRefundPolicy() {
}
};
const handleSaveClick = async () => {
- if (olderContent.length===0) {
+ if (olderContent === undefined || olderContent === "") {
await addTermsandConditions();
setAdded(true);
} else {
@@ -128,19 +126,21 @@ export default function editRefundPolicy() {
>
Save
-
+
+
+
diff --git a/src/views/Content/editShippingPolicy.js b/src/views/Content/editShippingPolicy.js
index 6286e30..f1dbd87 100644
--- a/src/views/Content/editShippingPolicy.js
+++ b/src/views/Content/editShippingPolicy.js
@@ -6,17 +6,17 @@ import ReactQuill from "react-quill";
import "react-quill/dist/quill.snow.css";
import axios from "axios";
import { isAutheticated } from "src/auth";
-import { useNavigate, useNavigation } from "react-router-dom";
+import { Link, useNavigate, useNavigation } from "react-router-dom";
const TOOLBAR_OPTIONS = [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ font: [] }],
[{ list: "ordered" }, { list: "bullet" }],
- ["bold", "italic", "underline", "strike"],
+ ["bold", "italic", "underline", "strike"],
[{ color: [] }, { background: [] }],
[{ align: [] }],
- [{ script: "super" }, { script: "sub" }],
- ["undo", "redo"],
+ [{ script: "super" }, { script: "sub" }],
+ ["undo", "redo"],
];
export default function EditShippingPolicy() {
@@ -24,8 +24,7 @@ export default function EditShippingPolicy() {
const [content, setContent] = useState("");
const [added, setAdded] = useState(false);
const [olderContent, setOlderContent] = useState("");
- const [id, setId] = useState(null)
-
+ const [id, setId] = useState(null);
const token = isAutheticated();
const handleContentChange = (content, delta, source, editor) => {
@@ -73,7 +72,7 @@ export default function EditShippingPolicy() {
"/api/content/shipping-and-policy-update",
{ content },
{
- params: { id: id },
+ params: { id: id },
headers: {
Authorization: `Bearer ${token}`,
},
@@ -97,7 +96,7 @@ export default function EditShippingPolicy() {
}
};
const handleSaveClick = async () => {
- if (olderContent.length===0) {
+ if (olderContent === undefined || olderContent === "") {
await addShipping();
setAdded(true);
} else {
@@ -128,19 +127,21 @@ export default function EditShippingPolicy() {
>
Save
-
+
+
+
diff --git a/src/views/Content/editTermsConditions.js b/src/views/Content/editTermsConditions.js
index 9e16e16..2ae62f0 100644
--- a/src/views/Content/editTermsConditions.js
+++ b/src/views/Content/editTermsConditions.js
@@ -6,17 +6,17 @@ import ReactQuill from "react-quill";
import "react-quill/dist/quill.snow.css";
import axios from "axios";
import { isAutheticated } from "src/auth";
-import { useNavigate, useNavigation } from "react-router-dom";
+import { Link, useNavigate, useNavigation } from "react-router-dom";
const TOOLBAR_OPTIONS = [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ font: [] }],
[{ list: "ordered" }, { list: "bullet" }],
- ["bold", "italic", "underline", "strike"],
+ ["bold", "italic", "underline", "strike"],
[{ color: [] }, { background: [] }],
[{ align: [] }],
- [{ script: "super" }, { script: "sub" }],
- ["undo", "redo"],
+ [{ script: "super" }, { script: "sub" }],
+ ["undo", "redo"],
];
export default function EditTermsConditions() {
@@ -24,8 +24,7 @@ export default function EditTermsConditions() {
const [content, setContent] = useState("");
const [added, setAdded] = useState(false);
const [olderContent, setOlderContent] = useState("");
- const [id, setId] = useState(null)
-
+ const [id, setId] = useState(null);
const token = isAutheticated();
const handleContentChange = (content, delta, source, editor) => {
@@ -38,14 +37,11 @@ export default function EditTermsConditions() {
},
});
if (response.status === 200) {
- // console.log(response);
setContent(response?.data?.termsAndCondition[0]?.termsAndContionContent);
setOlderContent(
response?.data?.termsAndCondition[0]?.termsAndContionContent
);
- setId(
- response?.data?.termsAndCondition[0]?._id
- );
+ setId(response?.data?.termsAndCondition[0]?._id);
}
};
@@ -76,7 +72,7 @@ export default function EditTermsConditions() {
"/api/content/terms-and-condition-update",
{ content },
{
- params: { id: id },
+ params: { id: id },
headers: {
Authorization: `Bearer ${token}`,
},
@@ -100,7 +96,7 @@ export default function EditTermsConditions() {
}
};
const handleSaveClick = async () => {
- if (olderContent.length===0) {
+ if (olderContent === undefined || olderContent === "") {
await addTermsandConditions();
setAdded(true);
} else {
@@ -131,19 +127,21 @@ export default function EditTermsConditions() {
>
Save
-
+
+
+