From 973783b95a6e58dfef2ea9d68bf03a7e7c552052 Mon Sep 17 00:00:00 2001 From: pawan-dot <71133473+pawan-dot@users.noreply.github.com> Date: Thu, 30 Jun 2022 15:17:17 +0530 Subject: [PATCH] make it betterlkjkfkf --- src/components/AppFooter.js | 2 +- src/index.js | 4 +-- src/views/Banners/AddBanner.js | 60 ++++++++++++++++++++++++++++++---- src/views/Banners/Banner.js | 13 ++++++++ src/views/Users/ViewUsers.js | 2 +- 5 files changed, 71 insertions(+), 10 deletions(-) diff --git a/src/components/AppFooter.js b/src/components/AppFooter.js index 0560963..90a810f 100644 --- a/src/components/AppFooter.js +++ b/src/components/AppFooter.js @@ -8,7 +8,7 @@ const AppFooter = () => { {new Date().getFullYear()} © CMP. - \ + ) } diff --git a/src/index.js b/src/index.js index 34efee9..f582681 100644 --- a/src/index.js +++ b/src/index.js @@ -10,8 +10,8 @@ import store from './store' import axios from 'axios' const setupAxios = () => { - axios.defaults.baseURL = 'https://cms-api-dashboard.herokuapp.com/'; - //axios.defaults.baseURL = 'http://localhost:5000' + //axios.defaults.baseURL = 'https://cms-api-dashboard.herokuapp.com/'; + axios.defaults.baseURL = 'http://localhost:5000' axios.defaults.headers = { 'Cache-Control': 'no-cache,no-store', 'Pragma': 'no-cache', diff --git a/src/views/Banners/AddBanner.js b/src/views/Banners/AddBanner.js index 1dbebd0..6affc3c 100644 --- a/src/views/Banners/AddBanner.js +++ b/src/views/Banners/AddBanner.js @@ -20,7 +20,7 @@ import { CRow, } from '@coreui/react' import CIcon from '@coreui/icons-react' -import { cilPencil, cilNotes, cilCalendar } from '@coreui/icons' +import { cilPencil, cilNotes, cilCalendar, cilAddressBook, cil3d, cilActionUndo, cilNoteAdd } from '@coreui/icons' const AddBanner = () => { const { token } = isAutheticated(); let history = useHistory(); @@ -31,17 +31,23 @@ const AddBanner = () => { const [startDate, setStartDate] = useState(new Date()); const [endDate, setEndDate] = useState(new Date()); + const [subSection, setSubSection] = useState(""); + const [category, setCategory] = useState(false); + + const [loading, setLoading] = useState(false); + const handleSubmit = async () => { const myForm = new FormData(); myForm.set("title", title); myForm.set("subTitle", subTitle); myForm.set("section", section); + myForm.set("subSection", subSection); myForm.set("startDate", startDate); myForm.set("endDate", endDate); myForm.set("image", image); @@ -77,6 +83,26 @@ const AddBanner = () => { }; + useEffect(() => { + const getData = async () => { + let res = await axios.get( + `/api/category/getAll`, + { + headers: { + Authorization: `Bearer ${token}`, + }, + } + ); + console.log(res.data) + setCategory(res.data.category) + } + if (section === "category") { + getData() + } else { + setCategory(false) + } + }, [section]) + return ( <>