Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 51a3c60590 | |||
| ab597039ba | |||
| 6fd2dcdb3d | |||
| c8fe2eadf6 | |||
| 1e174b7432 | |||
| d0f1d5ee34 | |||
| a2843d97e2 |
@@ -1,11 +1,13 @@
|
|||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { Form, Formik } from "formik";
|
import { Form, Formik } from "formik";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
import { useDispatch } from 'react-redux'
|
||||||
|
|
||||||
import { Link, useNavigate, useParams } from 'react-router-dom'
|
import { Link, useNavigate, useParams } from 'react-router-dom'
|
||||||
import siteLinks from '../../links/siteLinks'
|
import siteLinks from '../../links/siteLinks'
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { completeRegistration, verifyEmail } from '../../services/services';
|
import { completeRegistration, verifyEmail } from '../../services/services';
|
||||||
|
import { updateUserDetails } from '../../store/UserDetails'
|
||||||
|
|
||||||
import { IoMdArrowDropdown } from "react-icons/io";
|
import { IoMdArrowDropdown } from "react-icons/io";
|
||||||
|
|
||||||
@@ -29,6 +31,8 @@ export default function CSignup() {
|
|||||||
|
|
||||||
const {jwt} = useParams()
|
const {jwt} = useParams()
|
||||||
|
|
||||||
|
const dispatch = useDispatch()
|
||||||
|
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
const [user, setUser] = useState(null)
|
const [user, setUser] = useState(null)
|
||||||
@@ -51,15 +55,19 @@ export default function CSignup() {
|
|||||||
return completeRegistration(fields)
|
return completeRegistration(fields)
|
||||||
},
|
},
|
||||||
onSuccess: (res) => {
|
onSuccess: (res) => {
|
||||||
const {token, room} = res?.data?.data
|
if(res?.data?.resultCode != '0'){
|
||||||
if(token){
|
throw({message: res?.data?.resultDescription})
|
||||||
localStorage.setItem('token', token)
|
|
||||||
localStorage.setItem('room', room)
|
|
||||||
// const data = {token}
|
|
||||||
// dispatch(updateUserDetails({ ...data }));
|
|
||||||
navigate('/dash') // later add redux to dispatch state
|
|
||||||
}
|
}
|
||||||
}
|
const {token, room, uid} = res?.data
|
||||||
|
if(!token || !room){
|
||||||
|
throw({message: 'something went wrong, try again!'})
|
||||||
|
}
|
||||||
|
localStorage.setItem('token', token)
|
||||||
|
localStorage.setItem('room', room)
|
||||||
|
localStorage.setItem('uid', uid)
|
||||||
|
dispatch(updateUserDetails({ ...res?.data }));
|
||||||
|
navigate('/dash') // later add redux to dispatch state
|
||||||
|
},
|
||||||
// onError: (err) => {
|
// onError: (err) => {
|
||||||
// console.log('err', err)
|
// console.log('err', err)
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export default function Signup2() {
|
|||||||
const signUp = (values) => {
|
const signUp = (values) => {
|
||||||
// helpers.resetForm()
|
// helpers.resetForm()
|
||||||
// console.log('values', values, helpers)
|
// console.log('values', values, helpers)
|
||||||
|
delete values.isChecked
|
||||||
mutation.mutate(values)
|
mutation.mutate(values)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,29 +21,37 @@ export default function Calendar(){
|
|||||||
// queryFn: () => getCalendarEvents()
|
// queryFn: () => getCalendarEvents()
|
||||||
// })
|
// })
|
||||||
|
|
||||||
const calendarEvents = useMutation({
|
// const calendarEvents = useMutation({
|
||||||
mutationFn: (reqData) => {
|
// mutationFn: (reqData) => {
|
||||||
return getCalendarEvents(reqData)
|
// return getCalendarEvents(reqData)
|
||||||
},
|
// },
|
||||||
onError: (error) => {
|
// onError: (error) => {
|
||||||
console.log(error)
|
// console.log(error)
|
||||||
},
|
// },
|
||||||
onSuccess: (res) => {
|
// onSuccess: (res) => {
|
||||||
if(res?.data?.resultCode != '0'){
|
// if(res?.data?.resultCode != '0'){
|
||||||
throw({message: 'Something went wrong'})
|
// throw({message: 'Something went wrong'})
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
|
|
||||||
useEffect(()=>{
|
// useEffect(()=>{
|
||||||
|
// let reqData = {
|
||||||
|
// token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
// uid: localStorage.getItem('uid') // USER UID
|
||||||
|
// }
|
||||||
|
// calendarEvents.mutate(reqData)
|
||||||
|
// },[])
|
||||||
let reqData = {
|
let reqData = {
|
||||||
token: localStorage.getItem('token'), // USER TOKEN
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
uid: localStorage.getItem('uid') // USER UID
|
uid: localStorage.getItem('uid') // USER UID
|
||||||
}
|
}
|
||||||
calendarEvents.mutate(reqData)
|
const {data, isFetching, isError, error} = useQuery({
|
||||||
},[])
|
queryKey: queryKeys.calendar_events,
|
||||||
|
queryFn: () => getCalendarEvents(reqData)
|
||||||
|
})
|
||||||
|
|
||||||
const receievedEvents = calendarEvents?.data?.data
|
const receievedEvents = data?.data
|
||||||
const category = receievedEvents?.category //EVENT CATEGORIES FROM API
|
const category = receievedEvents?.category //EVENT CATEGORIES FROM API
|
||||||
const eventList = receievedEvents?.list //EVENT LIST FROM API
|
const eventList = receievedEvents?.list //EVENT LIST FROM API
|
||||||
|
|
||||||
@@ -84,15 +92,15 @@ export default function Calendar(){
|
|||||||
</div>
|
</div>
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<div className="row">
|
<div className="row">
|
||||||
{calendarEvents?.isPending ?
|
{isFetching ?
|
||||||
<>
|
<>
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<p className='text-mute'>Loading...</p>
|
<p className='text-mute'>Loading...</p>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
: calendarEvents?.error ?
|
: isError ?
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<p className='text-danger'>{calendarEvents?.error?.message}</p>
|
<p className='text-danger'>{error?.message}</p>
|
||||||
</div>
|
</div>
|
||||||
:
|
:
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export default function EventCalendar({removeAfterDrop, eventList, activeCategor
|
|||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
// let newEventList = eventList?.map(item => ({...item, start: new Date(item?.start)}))
|
// let newEventList = eventList?.map(item => ({...item, start: new Date(item?.start)}))
|
||||||
let newEventList = eventList?.filter(item => (Number(item.category) == Number(activeCategory)))?.map(item => ({...item, start: new Date(item?.start)}))
|
let newEventList = eventList?.filter(item => (Number(item.category) == Number(activeCategory)))?.map(item => ({...item, start: new Date(item?.start)}))
|
||||||
console.log('newEventList', newEventList)
|
// console.log('newEventList', newEventList)
|
||||||
setCurrentEvents(newEventList)
|
setCurrentEvents(newEventList)
|
||||||
},[activeCategory])
|
},[activeCategory])
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,22 @@
|
|||||||
import React, {useEffect} from 'react'
|
import { useQuery } from '@tanstack/react-query'
|
||||||
import { useMutation } from '@tanstack/react-query'
|
|
||||||
import { productsData } from '../../services/services'
|
import { productsData } from '../../services/services'
|
||||||
import productPath from "../../utils/productpath";
|
import productPath from "../../utils/productpath";
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
import queryKeys from '../../services/queryKeys'
|
||||||
|
|
||||||
|
|
||||||
export default function Products() {
|
export default function Products() {
|
||||||
const getProductsData = useMutation({
|
|
||||||
mutationFn: (reqData) => {
|
|
||||||
return productsData(reqData)
|
|
||||||
},
|
|
||||||
onError: (error) => {
|
|
||||||
console.log(error)
|
|
||||||
},
|
|
||||||
onSuccess: (res) => {
|
|
||||||
if(res?.data?.resultCode != '0'){
|
|
||||||
throw({message: 'Something went wrong'})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
useEffect(()=>{
|
let reqData = {
|
||||||
let reqData = {
|
|
||||||
token: localStorage.getItem('token'), // USER TOKEN
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
uid: localStorage.getItem('uid') // USER UID
|
uid: localStorage.getItem('uid') // USER UID
|
||||||
}
|
}
|
||||||
getProductsData.mutate(reqData)
|
const {data, isFetching, isError, error} = useQuery({
|
||||||
},[])
|
queryKey: queryKeys.product,
|
||||||
|
queryFn: () => productsData(reqData)
|
||||||
const products = getProductsData?.data?.data?.products_data // PRODUCTS DATA
|
})
|
||||||
|
const products = data?.data?.products_data // PRODUCTS DATA
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -37,7 +25,7 @@ export default function Products() {
|
|||||||
<h4 className="card-title">My Products</h4>
|
<h4 className="card-title">My Products</h4>
|
||||||
</div>
|
</div>
|
||||||
<div className="card-body pb-0">
|
<div className="card-body pb-0">
|
||||||
{getProductsData?.isPending ?
|
{isFetching ?
|
||||||
<>
|
<>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
@@ -45,10 +33,10 @@ export default function Products() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
: getProductsData?.isPending ?
|
: isError ?
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<p className='text-danger'>{getProductsData?.error?.message}</p>
|
<p className='text-danger'>{error?.message}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
:
|
:
|
||||||
|
|||||||
@@ -5,12 +5,18 @@ import queryKeys from '../../services/queryKeys'
|
|||||||
|
|
||||||
export default function ProductsURL() {
|
export default function ProductsURL() {
|
||||||
|
|
||||||
const {data:data, isFetching, isError, error} = useQuery({
|
let reqData = {
|
||||||
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
uid: localStorage.getItem('uid') // USER UID
|
||||||
|
}
|
||||||
|
|
||||||
|
const {data, isFetching, isError, error} = useQuery({
|
||||||
queryKey: queryKeys.product_url,
|
queryKey: queryKeys.product_url,
|
||||||
queryFn: () => productsURL()
|
queryFn: () => productsURL(reqData)
|
||||||
})
|
})
|
||||||
|
|
||||||
const urlData = data?.data?.url_data?.url
|
const urlData = data?.data?.products_data
|
||||||
|
// console.log('data', urlData)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -57,8 +63,8 @@ export default function ProductsURL() {
|
|||||||
let productUrl = '/product/'+ item?.product_id
|
let productUrl = '/product/'+ item?.product_id
|
||||||
return (
|
return (
|
||||||
<tr key={index}>
|
<tr key={index}>
|
||||||
<td>{Number(item?.no) + Number(index)}</td>
|
<td>{Number(item?.id)}</td>
|
||||||
<td>{item?.description} - <a href={productUrl} target='_blank'>{item?.url}</a></td>
|
<td>{item?.description} - <a href={productUrl} target='_blank'>{item?.external_url}</a></td>
|
||||||
|
|
||||||
<td><span className={`badge ${statusColor}`}>{item?.status}</span></td>
|
<td><span className={`badge ${statusColor}`}>{item?.status}</span></td>
|
||||||
<td><a className="mr-3" href=""><i className="fe fe-edit"></i></a></td>
|
<td><a className="mr-3" href=""><i className="fe fe-edit"></i></a></td>
|
||||||
|
|||||||
@@ -1,36 +1,44 @@
|
|||||||
import React, {useEffect} from 'react'
|
import { useQuery } from '@tanstack/react-query'
|
||||||
import { useMutation } from '@tanstack/react-query'
|
|
||||||
import { topBar } from '../../services/services'
|
import { topBar } from '../../services/services'
|
||||||
|
import queryKeys from '../../services/queryKeys'
|
||||||
|
|
||||||
export default function TopBar() {
|
export default function TopBar() {
|
||||||
|
|
||||||
const topBarData = useMutation({
|
// const topBarData = useMutation({
|
||||||
mutationFn: (reqData) => {
|
// mutationFn: (reqData) => {
|
||||||
return topBar(reqData)
|
// return topBar(reqData)
|
||||||
},
|
// },
|
||||||
onError: (error) => {
|
// onError: (error) => {
|
||||||
console.log(error)
|
// console.log(error)
|
||||||
},
|
// },
|
||||||
onSuccess: (res) => {
|
// onSuccess: (res) => {
|
||||||
if(res?.data?.resultCode != '0'){
|
// if(res?.data?.resultCode != '0'){
|
||||||
throw({message: 'Something went wrong'})
|
// throw({message: 'Something went wrong'})
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
|
|
||||||
useEffect(()=>{
|
// useEffect(()=>{
|
||||||
let reqData = {
|
// let reqData = {
|
||||||
|
// token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
// uid: localStorage.getItem('uid') // USER UID
|
||||||
|
// }
|
||||||
|
// topBarData.mutate(reqData)
|
||||||
|
// },[])
|
||||||
|
|
||||||
|
let reqData = {
|
||||||
token: localStorage.getItem('token'), // USER TOKEN
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
uid: localStorage.getItem('uid') // USER UID
|
uid: localStorage.getItem('uid') // USER UID
|
||||||
}
|
}
|
||||||
topBarData.mutate(reqData)
|
const {data:topBarData, isFetching, isError, error} = useQuery({
|
||||||
},[])
|
queryKey: queryKeys.topBar,
|
||||||
|
queryFn: () => topBar(reqData)
|
||||||
const data = topBarData?.data?.data?.top_bar // top bar data
|
})
|
||||||
|
const data = topBarData?.data?.top_bar // top bar data
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{topBarData.isPending ?
|
{isFetching ?
|
||||||
<>
|
<>
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<div className="card p-4">
|
<div className="card p-4">
|
||||||
@@ -38,10 +46,10 @@ export default function TopBar() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
: topBarData.error ?
|
: isError?
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<div className="card p-4">
|
<div className="card p-4">
|
||||||
<p className='text-danger'>{topBarData.error.message}</p>
|
<p className='text-danger'>{error.message}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
:
|
:
|
||||||
|
|||||||
+17
-17
@@ -99,6 +99,22 @@ export const contactData = (reqData) => {
|
|||||||
return postAuxEnd(`/panel/contacts`, postData, false)
|
return postAuxEnd(`/panel/contacts`, postData, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO GET DASHBOARD PRODUCT URL DATA SECTION
|
||||||
|
export const productsURL = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData,
|
||||||
|
}
|
||||||
|
return postAuxEnd(`/panel/account/products/url`, postData, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO GET DASHBOARD PRODUCT DATA SECTION
|
||||||
|
export const productsData = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData,
|
||||||
|
}
|
||||||
|
return postAuxEnd(`/panel/account/products`, postData, false)
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION TO GET DASHBOARD RECENT ACTIONS SECTION
|
// FUNCTION TO GET DASHBOARD RECENT ACTIONS SECTION
|
||||||
export const recentActions = (reqData) => {
|
export const recentActions = (reqData) => {
|
||||||
let postData = {
|
let postData = {
|
||||||
@@ -110,29 +126,13 @@ export const recentActions = (reqData) => {
|
|||||||
return postAuxEnd(`/panel/account/actions`, postData, false)
|
return postAuxEnd(`/panel/account/actions`, postData, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION TO GET DASHBOARD PRODUCT DATA SECTION
|
|
||||||
export const productsData = (reqData) => {
|
|
||||||
let postData = {
|
|
||||||
...reqData,
|
|
||||||
}
|
|
||||||
return postAuxEnd(`/panel/account/products`, postData, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// FUNCTION TO GET DASHBOARD PRODUCT URL DATA SECTION
|
|
||||||
export const productsURL = (reqData) => {
|
|
||||||
let postData = {
|
|
||||||
...reqData,
|
|
||||||
token: localStorage.getItem('token'), // USER TOKEN
|
|
||||||
uid: localStorage.getItem('uid') // USER UID
|
|
||||||
}
|
|
||||||
return postAuxEnd(`/panel/account/products/url`, postData, false)
|
|
||||||
// return getAuxEnd(`/panel/account/products/url`)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCTION TO REGISTER USER
|
// FUNCTION TO REGISTER USER
|
||||||
export const signUpUser = (reqData) => {
|
export const signUpUser = (reqData) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user