Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d31507984 | |||
| a3dbc8cab1 | |||
| 29878e3ddf | |||
| 80a40da9df | |||
| 9f7f1b706b | |||
| d878d1d098 | |||
| 3a60d4e12c | |||
| c03c70b07e | |||
| 9d158fe1cb | |||
| ffd80d9888 | |||
| 384da476a6 | |||
| 3576e7f702 | |||
| 5ed94fee53 | |||
| dbf81a4cf5 | |||
| 0984d78f1e | |||
| ade91c4ed8 | |||
| 905e783f76 |
@@ -1,6 +1,6 @@
|
||||
SKIP_PREFLIGHT_CHECK=true
|
||||
REACT_APP_NODE_ENV="development"
|
||||
REACT_APP_SOCKET_URL="https://dev-socket.mermsemr.com"
|
||||
REACT_APP_SOCKET_URL="https://devsocket.mermsemr.com"
|
||||
REACT_APP_MAIN_API="https://devapi.mermsemr.com"
|
||||
REACT_APP_MEDIA_SERVER="https://dev-media.mermsemr.com"
|
||||
REACT_APP_MAIN_SOCKET="https://dev-socket.mermsemr.com"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
SKIP_PREFLIGHT_CHECK=true
|
||||
REACT_APP_NODE_ENV="development"
|
||||
REACT_APP_SOCKET_URL="https://dev-socket.mermsemr.com"
|
||||
REACT_APP_SOCKET_URL="https://devsocket.mermsemr.com"
|
||||
REACT_APP_MAIN_API="https://devapi.mermsemr.com"
|
||||
REACT_APP_MEDIA_SERVER="https://dev-media.mermsemr.com"
|
||||
REACT_APP_MAIN_SOCKET="https://dev-socket.mermsemr.com"
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
SKIP_PREFLIGHT_CHECK=true
|
||||
REACT_APP_NODE_ENV="production"
|
||||
REACT_APP_SOCKET_URL="https://socket.mermsemr.com"
|
||||
REACT_APP_MAIN_API="https://api.mermsemr.com"
|
||||
REACT_APP_MAIN_API="https://devapi.mermsemr.com"
|
||||
REACT_APP_MEDIA_SERVER="https://media.mermsemr.com"
|
||||
|
||||
# login footer links
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
version: '3'
|
||||
services:
|
||||
merms-panel:
|
||||
# image: registry.chiefsoft.net/wrenchboard-users-wrench:latest
|
||||
image: registry.chiefsoft.net/merms-panel-reactjs:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile
|
||||
|
||||
+2
-1
@@ -33,7 +33,8 @@
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start -e .env.development",
|
||||
"build": "GENERATE_SOURCEMAP=false react-scripts build -e .env.production",
|
||||
"build": "react-scripts start -e .env.development",
|
||||
"build_real": "GENERATE_SOURCEMAP=false react-scripts build -e .env.production",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
|
||||
+23
-20
@@ -2,6 +2,7 @@ import { Routes, Route } from 'react-router-dom';
|
||||
|
||||
import UserExist from './component/authorization/UserExist';
|
||||
import AuthLayout from './component/auth/AuthLayout';
|
||||
import BearerToken from './component/authorization/BearerToken';
|
||||
import siteLinks from './links/siteLinks';
|
||||
|
||||
import LoginPage from './views/LoginPage';
|
||||
@@ -22,27 +23,29 @@ function AppRouters() {
|
||||
return (
|
||||
<div className="">
|
||||
<Routes>
|
||||
{/* auth routes wrapper */}
|
||||
<Route element={<AuthLayout />}>
|
||||
<Route path={siteLinks.home} element={<LoginPage />} />
|
||||
<Route path={siteLinks.login} element={<LoginPage />} />
|
||||
<Route path={siteLinks.signup} element={<SignupPage />} />
|
||||
<Route path={siteLinks.forgetpwd} element={<ForgetpwdPage />} />
|
||||
<Route path={siteLinks.csignup} element={<CSignupPage />} />
|
||||
<Route path={siteLinks.error} element={<LoginPage />} />
|
||||
</Route>
|
||||
<Route element={<BearerToken />}>
|
||||
{/* auth routes wrapper */}
|
||||
<Route element={<AuthLayout />}>
|
||||
<Route path={siteLinks.home} element={<LoginPage />} />
|
||||
<Route path={siteLinks.login} element={<LoginPage />} />
|
||||
<Route path={siteLinks.signup} element={<SignupPage />} />
|
||||
<Route path={siteLinks.forgetpwd} element={<ForgetpwdPage />} />
|
||||
<Route path={siteLinks.csignup} element={<CSignupPage />} />
|
||||
<Route path={siteLinks.error} element={<LoginPage />} />
|
||||
</Route>
|
||||
|
||||
{/* protected routes */}
|
||||
<Route element={<SocketIOContextProvider />}>
|
||||
<Route element={<UserExist />}>
|
||||
<Route path={siteLinks.dash} element={<HomePage />} />
|
||||
<Route path={siteLinks.product} element={<ProductPage />} />
|
||||
<Route path={siteLinks.reports} element={<ReportsPage />} />
|
||||
<Route path={siteLinks.comments} element={<CommentsPage />} />
|
||||
<Route path={siteLinks.contacts} element={<ContactsPage />} />
|
||||
<Route path={siteLinks.user} element={<UserPage />} />
|
||||
<Route path={siteLinks.calendar} element={<CalendarPage />} />
|
||||
<Route path={siteLinks.settings} element={<SettingsPage />} />
|
||||
{/* protected routes */}
|
||||
<Route element={<SocketIOContextProvider />}>
|
||||
<Route element={<UserExist />}>
|
||||
<Route path={siteLinks.dash} element={<HomePage />} />
|
||||
<Route path={siteLinks.product} element={<ProductPage />} />
|
||||
<Route path={siteLinks.reports} element={<ReportsPage />} />
|
||||
<Route path={siteLinks.comments} element={<CommentsPage />} />
|
||||
<Route path={siteLinks.contacts} element={<ContactsPage />} />
|
||||
<Route path={siteLinks.user} element={<UserPage />} />
|
||||
<Route path={siteLinks.calendar} element={<CalendarPage />} />
|
||||
<Route path={siteLinks.settings} element={<SettingsPage />} />
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
</Routes>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import { useDispatch, useSelector } from 'react-redux'
|
||||
|
||||
// import LoginImg from '../../assets/bg/login.svg'
|
||||
|
||||
@@ -14,14 +14,17 @@ import IOSDownload from '../../assets/img/download/apple.jpg'
|
||||
|
||||
export default function Login() {
|
||||
|
||||
const { userDetails: { token, room }} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
||||
let loggedIn = token && room ? true : false; // variable to determine if user is logged in
|
||||
|
||||
const dispatch = useDispatch()
|
||||
|
||||
const navigate = useNavigate()
|
||||
|
||||
const [fields, setFields] = useState({
|
||||
username: localStorage.getItem('username') || '',
|
||||
username: '',
|
||||
password: '',
|
||||
remember: localStorage.getItem('username') ? true : false
|
||||
remember: false
|
||||
})
|
||||
|
||||
const handleChange = ({target:{name, value}}) => {
|
||||
@@ -37,20 +40,25 @@ export default function Login() {
|
||||
throw new Error('Please provide all fields marked *')
|
||||
}
|
||||
rememberMe(fields.remember) // FUNCTION TO SAVE USERNAME OF THE USER TO LOCAL STORAGE
|
||||
delete fields.remember // REMOVING REMEMBER FROM THE PAYLOAD
|
||||
return loginUser(fields)
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log(error)
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
const {token, room} = res?.data?.data
|
||||
if(token){
|
||||
localStorage.setItem('token', token)
|
||||
localStorage.setItem('room', room)
|
||||
// const data = {token}
|
||||
// dispatch(updateUserDetails({ ...data }));
|
||||
navigate('/dash') // later add redux to dispatch state
|
||||
if(res?.data?.error_message){
|
||||
throw({message: res?.data?.error_message})
|
||||
}
|
||||
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
|
||||
}
|
||||
})
|
||||
|
||||
@@ -62,6 +70,12 @@ export default function Login() {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(()=>{ // NAVIGATES USER TO HOME PAGE IF USER IS ACTIVE
|
||||
if(loggedIn){
|
||||
navigate(siteLinks.dash)
|
||||
}
|
||||
},[])
|
||||
|
||||
return (
|
||||
<div className="app">
|
||||
<div className="app-wrap">
|
||||
@@ -79,19 +93,19 @@ export default function Login() {
|
||||
<div className="col-12">
|
||||
<div className="form-group">
|
||||
<label className="control-label text-black fw-bold">User Name*</label>
|
||||
<input name='username' value={fields.username} onChange={handleChange} type="text" className="form-control" placeholder="Username" />
|
||||
<input maxLength={55} name='username' value={fields.username} onChange={handleChange} type="text" className="form-control" placeholder="Username" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-12">
|
||||
<div className="form-group">
|
||||
<label className="control-label text-black fw-bold">Password*</label>
|
||||
<input name='password' value={fields.password} onChange={handleChange} type="password" className="form-control" placeholder="Password" />
|
||||
<input maxLength={55} name='password' value={fields.password} onChange={handleChange} type="password" className="form-control" placeholder="Password" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-12">
|
||||
<div className="d-block d-sm-flex align-items-center">
|
||||
<div className="form-check">
|
||||
<input className="form-check-input" type="checkbox" id="gridCheck" name='remember' checked={fields.remember} onChange={handleChange} disabled={!fields.username ? true : false} />
|
||||
<input className="form-check-input" type="checkbox" id="gridCheck" name='remember' checked={fields.remember || false} onChange={handleChange} disabled={!fields.username ? true : false} />
|
||||
<label className="form-check-label text-black" htmlFor="gridCheck">
|
||||
Remember Me
|
||||
</label>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import {useEffect} from 'react'
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { Outlet } from 'react-router-dom'
|
||||
import MainLoaderBS from '../loaders/MainLoaderBS'
|
||||
|
||||
import { userToken } from '../../services/services'
|
||||
|
||||
export default function BearerToken() {
|
||||
const bearerToken = useMutation({
|
||||
mutationFn: (fields) => {
|
||||
return userToken(fields)
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log(error)
|
||||
// window.location.reload(true)
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
if(res?.data?.resultCode != '0'){
|
||||
throw({message: 'Something went wrong'})
|
||||
}
|
||||
const {access_token, refresh_token} = res?.data?.data
|
||||
if(access_token){
|
||||
localStorage.setItem('access_token', access_token)
|
||||
}else{
|
||||
throw({message: 'Something went wrong'})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
useEffect(()=>{
|
||||
let reqData = {
|
||||
"username": "user",
|
||||
"password": "password"
|
||||
}
|
||||
bearerToken.mutate(reqData)
|
||||
},[])
|
||||
|
||||
return (
|
||||
<>
|
||||
{bearerToken.isPending ?
|
||||
<MainLoaderBS />
|
||||
:
|
||||
<Outlet />
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { Outlet, useNavigate } from 'react-router-dom'
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
|
||||
import { updateUserDetails } from "../../store/UserDetails";
|
||||
import { userInfo } from '../../services/services'
|
||||
import MainLoaderBS from '../loaders/MainLoaderBS'
|
||||
import Layout from '../layout/Layout'
|
||||
import siteLinks from '../../links/siteLinks'
|
||||
|
||||
import debounceFunction from '../../utils/debounceFunction'
|
||||
import { accountDashboard } from '../../services/services';
|
||||
import { SocketContextValues } from '../context/SocketIOContext';
|
||||
|
||||
|
||||
@@ -23,9 +25,9 @@ export default function UserExist() {
|
||||
|
||||
const [lastActivityTime, setLastActivityTime] = useState(Date.now()); // HOLDS THE INITIAL TIME USER LOGS IN
|
||||
|
||||
const { userDetails: { lastname }} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
||||
const { userDetails: { token, room }} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
||||
|
||||
let loggedIn = lastname ? true : false; // variable to determine if user is logged in
|
||||
let loggedIn = token && room ? true : false; // variable to determine if user is logged in
|
||||
// console.log('loggedIn', loggedIn)
|
||||
|
||||
// Function to log the user out
|
||||
@@ -40,6 +42,31 @@ export default function UserExist() {
|
||||
debounceFunction(setLastActivityTime(Date.now()), 1000)
|
||||
};
|
||||
|
||||
|
||||
|
||||
const getUser = useMutation({
|
||||
mutationFn: (fields) => {
|
||||
return userInfo(fields)
|
||||
},
|
||||
onError: (error) => {
|
||||
navigate(siteLinks.login)
|
||||
setLoading(false)
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
const {token, room, uid} = res?.data
|
||||
if(!token || !room){
|
||||
navigate(siteLinks.login)
|
||||
setLoading(false)
|
||||
return
|
||||
}
|
||||
localStorage.setItem('token', token)
|
||||
localStorage.setItem('room', room)
|
||||
localStorage.setItem('uid', uid)
|
||||
dispatch(updateUserDetails({ ...res?.data }));
|
||||
setLoading(false)
|
||||
}
|
||||
})
|
||||
|
||||
useEffect(()=>{
|
||||
const timer = setTimeout(()=>{
|
||||
if(Date.now() - Number(lastActivityTime) >= Number(process.env.REACT_APP_TIMEOUT)){
|
||||
@@ -61,37 +88,21 @@ export default function UserExist() {
|
||||
window.removeEventListener(event, resetTimer);
|
||||
})
|
||||
}
|
||||
},[lastActivityTime])
|
||||
|
||||
},[lastActivityTime])
|
||||
|
||||
useEffect(()=>{
|
||||
accountDashboard().then(res => {
|
||||
const {dash_data} = res?.data
|
||||
let token = localStorage.getItem('token') // USER TOKEN
|
||||
let uid = localStorage.getItem('uid') // USER UID
|
||||
if(token && loggedIn){
|
||||
setLoading(false)
|
||||
dispatch(updateUserDetails({ ...dash_data }));
|
||||
}).catch(err => {
|
||||
}else if(token && uid && !loggedIn){
|
||||
const reqData = {token, uid}
|
||||
getUser.mutate(reqData)
|
||||
}else{
|
||||
navigate(siteLinks.login)
|
||||
setLoading(false)
|
||||
})
|
||||
}
|
||||
},[])
|
||||
|
||||
|
||||
// useEffect(()=>{
|
||||
// let token = localStorage.getItem('token')
|
||||
// const timer = setTimeout(()=>{
|
||||
// if(token && loggedIn){
|
||||
// setLoading(false)
|
||||
// }else if(token && !loggedIn){
|
||||
// const data = {token}
|
||||
// dispatch(updateUserDetails({ ...data }));
|
||||
// setLoading(false)
|
||||
// // dispatch(updateUserDetails({ ...res.data }));
|
||||
// }else{
|
||||
// navigate('auth/login')
|
||||
// }
|
||||
// },1000)
|
||||
|
||||
// return () => clearTimeout(timer)
|
||||
// },[])
|
||||
|
||||
useEffect(()=>{
|
||||
if(localStorage.getItem('room')){
|
||||
|
||||
@@ -1,29 +1,35 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import React from 'react'
|
||||
import { productData } from '../../services/services'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import React, {useEffect} from 'react'
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { productsData } from '../../services/services'
|
||||
import productPath from "../../utils/productpath";
|
||||
import { Link } from 'react-router-dom';
|
||||
export default function Products() {
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.product,
|
||||
queryFn: () => productData()
|
||||
|
||||
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'})
|
||||
}
|
||||
}
|
||||
})
|
||||
/*
|
||||
{
|
||||
"banner": "p1.jpg",
|
||||
"description": "Your personal professional web presence",
|
||||
"id": 1,
|
||||
"name": "Personal Website",
|
||||
"product_id": "A000001",
|
||||
"product_uid": "e92282b4-3ee1-4026-92ac-12cfd214b43a",
|
||||
"status": 5,
|
||||
"status_text": "Activate Now"
|
||||
},
|
||||
*/
|
||||
//const products = data?.data?.products_list?.products
|
||||
const products = data?.data?.products_list
|
||||
|
||||
useEffect(()=>{
|
||||
let reqData = {
|
||||
token: localStorage.getItem('token'), // USER TOKEN
|
||||
uid: localStorage.getItem('uid') // USER UID
|
||||
}
|
||||
getProductsData.mutate(reqData)
|
||||
},[])
|
||||
|
||||
const products = getProductsData?.data?.data?.products_data // PRODUCTS DATA
|
||||
console.log('PPP', products)
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -32,7 +38,7 @@ export default function Products() {
|
||||
<h4 className="card-title">My Products</h4>
|
||||
</div>
|
||||
<div className="card-body pb-0">
|
||||
{isFetching ?
|
||||
{getProductsData?.isPending ?
|
||||
<>
|
||||
<div className="row">
|
||||
<div className="col-12">
|
||||
@@ -40,10 +46,10 @@ export default function Products() {
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
: isError ?
|
||||
: getProductsData?.isPending ?
|
||||
<div className="row">
|
||||
<div className="col-12">
|
||||
<p className='text-danger'>{error.message}</p>
|
||||
<p className='text-danger'>{getProductsData?.error?.message}</p>
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
|
||||
@@ -1,20 +1,36 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import React from 'react'
|
||||
import React, {useEffect} from 'react'
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { topBar } from '../../services/services'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
|
||||
export default function TopBar() {
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.topBar,
|
||||
queryFn: () => topBar()
|
||||
})
|
||||
const topBarData = useMutation({
|
||||
mutationFn: (reqData) => {
|
||||
return topBar(reqData)
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log(error)
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
if(res?.data?.resultCode != '0'){
|
||||
throw({message: 'Something went wrong'})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const topData = data?.data?.bar_data?.top_bar
|
||||
useEffect(()=>{
|
||||
let reqData = {
|
||||
token: localStorage.getItem('token'), // USER TOKEN
|
||||
uid: localStorage.getItem('uid') // USER UID
|
||||
}
|
||||
topBarData.mutate(reqData)
|
||||
},[])
|
||||
|
||||
const data = topBarData?.data?.data?.top_bar // top bar data
|
||||
|
||||
return (
|
||||
<>
|
||||
{isFetching ?
|
||||
{topBarData.isPending ?
|
||||
<>
|
||||
<div className="col-12">
|
||||
<div className="card p-4">
|
||||
@@ -22,15 +38,15 @@ export default function TopBar() {
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
: isError ?
|
||||
: topBarData.error ?
|
||||
<div className="col-12">
|
||||
<div className="card p-4">
|
||||
<p className='text-danger'>{error.message}</p>
|
||||
<p className='text-danger'>{topBarData.error.message}</p>
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
<>
|
||||
{topData && topData?.map((item, index)=>{
|
||||
{data && data?.map((item, index)=>{
|
||||
let textColor = item?.description == 'Contacts' ? 'text-danger' : item?.description == 'Site Traffic' ? 'text-primary' : item?.description == 'Appointments' ? 'text-orange' : 'text-success'
|
||||
return (
|
||||
<div key={item.id + index} className="col-sm-6 col-xxl-3">
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import React from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { topBar } from '../../services/services'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
|
||||
export default function TopBar() {
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.topBar,
|
||||
queryFn: () => topBar()
|
||||
})
|
||||
|
||||
const topData = data?.data?.bar_data?.top_bar
|
||||
console.log('topData', topData)
|
||||
|
||||
return (
|
||||
<>
|
||||
{isFetching ?
|
||||
<>
|
||||
<div className="col-12">
|
||||
<div className="card p-4">
|
||||
<p className='text-mute'>Loading...</p>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
: isError ?
|
||||
<div className="col-12">
|
||||
<div className="card p-4">
|
||||
<p className='text-danger'>{error.message}</p>
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
<>
|
||||
{topData && topData?.map((item, index)=>{
|
||||
let textColor = item?.description == 'Contacts' ? 'text-danger' : item?.description == 'Site Traffic' ? 'text-primary' : item?.description == 'Appointments' ? 'text-orange' : 'text-success'
|
||||
return (
|
||||
<div key={item.id + index} className="col-sm-6 col-xxl-3">
|
||||
<div className="card card-statistics ecommerce-contant overflow-h">
|
||||
<div className="card-body p-0">
|
||||
<div className="d-flex m-b-0 ecommerce-contant-text h-100">
|
||||
<div className="w-100">
|
||||
<div className="row p-3">
|
||||
<div className="col">
|
||||
<h3 className="mb-0">{item?.value || 0}</h3>
|
||||
<small className="d-block">{item?.data_span}</small>
|
||||
</div>
|
||||
<div className="col text-right">
|
||||
<h5 className="text-muted mb-0">{item?.description}</h5>
|
||||
<strong className={`${textColor} m-t-5`}><i
|
||||
className="zmdi zmdi-long-arrow-up font-weight-bold"></i> N/A</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div className="apexchart-wrapper">
|
||||
<div id="ecommercedemo3" className="chart-fit"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
const queryKeys = {
|
||||
user_details: ['user_details'],
|
||||
|
||||
dashboard: ['dashboard'],
|
||||
topBar: ['top-bar'],
|
||||
recentAction: ['recent-action'],
|
||||
|
||||
+58
-30
@@ -4,12 +4,13 @@ import axios from "axios"
|
||||
axios.interceptors.request.use(
|
||||
config => {
|
||||
config.headers = {
|
||||
// Accept: "application/json",
|
||||
Accept: "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
// "Access-Control-Expose-Headers": "Access-Control-Allow-Origin",
|
||||
// "Access-Control-Allow-Headers": "Origin, X-API-KEY, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method, Access-Control-Allow-Headers, Authorization, observe, enctype, Content-Length, X-Csrf-Token",
|
||||
// "Content-Type": "application/json;charset=UTF-8",
|
||||
'Authorization': `Bearer ${localStorage.getItem('token')}`
|
||||
'Authorization': (localStorage && localStorage.getItem('access_token')) ? `Bearer ${localStorage.getItem('access_token')}` : '',
|
||||
// 'uuid': 'dummy'
|
||||
};
|
||||
// config.headers['Authorization'] = `Bearer ${localStorage.getItem('token')}`;
|
||||
// config.baseURL = process.env.REACT_APP_MAIN_API
|
||||
@@ -25,7 +26,7 @@ const postAuxEnd = (path, postData, media=false) => {
|
||||
return axios.post(`${basePath}${path}`, postData).then(res => {
|
||||
return res
|
||||
}).catch(err => {
|
||||
throw new Error(err.response.data.message);
|
||||
throw new Error(err.response.data.msg);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -42,12 +43,60 @@ const getAuxEnd = (path, reqData= null) => {
|
||||
})
|
||||
}
|
||||
|
||||
// FUNCTION TO AUTHORIZE USER IN
|
||||
export const userToken = (reqData) => {
|
||||
let postData = {
|
||||
...reqData
|
||||
}
|
||||
return postAuxEnd('/Authorize', postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO LOGIN USER IN
|
||||
export const loginUser = (reqData) => {
|
||||
let postData = {
|
||||
...reqData
|
||||
}
|
||||
return postAuxEnd('/panel/auth/login', postData, false)
|
||||
return postAuxEnd('/panel/Login', postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET USER INFO DATA
|
||||
export const userInfo = (reqData) => {
|
||||
let postData = {
|
||||
...reqData
|
||||
}
|
||||
return postAuxEnd('/panel/account', postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET DASHBOARD TOP BAR SECTION
|
||||
export const topBar = (reqData) => {
|
||||
let postData = {
|
||||
...reqData,
|
||||
}
|
||||
return postAuxEnd(`/panel/account/bar`, postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET DASHBOARD RECENT ACTIONS SECTION
|
||||
export const recentActions = (reqData) => {
|
||||
let postData = {
|
||||
...reqData,
|
||||
}
|
||||
//return getAuxEnd(`/panel/account/actions`)
|
||||
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 = () => {
|
||||
return getAuxEnd(`/panel/account/products/url`)
|
||||
}
|
||||
|
||||
// FUNCTION TO REGISTER USER
|
||||
@@ -91,24 +140,13 @@ export const recoverPWD = (reqData) => {
|
||||
return postAuxEnd('/panel/auth/reset', postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET DASHBOARD DATA
|
||||
export const accountDashboard = () => {
|
||||
return getAuxEnd(`/panel/account/dash`)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET DASHBOARD TOP BAR SECTION
|
||||
export const topBar = () => {
|
||||
return getAuxEnd(`/panel/account/bar`)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET CALENDAR EVENTS
|
||||
export const getCalendarEvents = () => {
|
||||
return getAuxEnd(`/panel/account/calendar`)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET DASHBOARD RECENT ACTIONS SECTION
|
||||
export const recentActions = () => {
|
||||
return getAuxEnd(`/panel/account/actions`)
|
||||
// return getAuxEnd(`/panel/account/calendar`)
|
||||
let postData = {
|
||||
"a":"b"
|
||||
}
|
||||
return postAuxEnd(`/panel/account/calendar`, postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET MY PRODUCT PROVISION DATA
|
||||
@@ -117,21 +155,11 @@ export const productProvision = (reqData) => {
|
||||
return getAuxEnd(`/panel/myproduct/provision`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET DASHBOARD PRODUCT DATA SECTION
|
||||
export const productData = () => {
|
||||
return getAuxEnd(`/panel/account/products`)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET DASHBOARD PRODUCT DATA SECTION
|
||||
export const contactData = () => {
|
||||
return getAuxEnd(`/panel/contacts`)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET DASHBOARD PRODUCT URL DATA SECTION
|
||||
export const productsURL = () => {
|
||||
return getAuxEnd(`/panel/account/products/url`)
|
||||
}
|
||||
|
||||
export const MyProductData = (productID) => {
|
||||
const reqData = { product_id : productID}
|
||||
//console.log(reqData)
|
||||
|
||||
Reference in New Issue
Block a user