Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d31507984 | |||
| a3dbc8cab1 |
@@ -1,29 +1,35 @@
|
|||||||
import { useQuery } from '@tanstack/react-query'
|
import React, {useEffect} from 'react'
|
||||||
import React from 'react'
|
import { useMutation } from '@tanstack/react-query'
|
||||||
import { productData } from '../../services/services'
|
import { productsData } from '../../services/services'
|
||||||
import queryKeys from '../../services/queryKeys'
|
|
||||||
import productPath from "../../utils/productpath";
|
import productPath from "../../utils/productpath";
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
export default function Products() {
|
|
||||||
|
|
||||||
const {data, isFetching, isError, error} = useQuery({
|
|
||||||
queryKey: queryKeys.product,
|
export default function Products() {
|
||||||
queryFn: () => productData()
|
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(()=>{
|
||||||
"banner": "p1.jpg",
|
let reqData = {
|
||||||
"description": "Your personal professional web presence",
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
"id": 1,
|
uid: localStorage.getItem('uid') // USER UID
|
||||||
"name": "Personal Website",
|
}
|
||||||
"product_id": "A000001",
|
getProductsData.mutate(reqData)
|
||||||
"product_uid": "e92282b4-3ee1-4026-92ac-12cfd214b43a",
|
},[])
|
||||||
"status": 5,
|
|
||||||
"status_text": "Activate Now"
|
const products = getProductsData?.data?.data?.products_data // PRODUCTS DATA
|
||||||
},
|
console.log('PPP', products)
|
||||||
*/
|
|
||||||
//const products = data?.data?.products_list?.products
|
|
||||||
const products = data?.data?.products_list
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -32,7 +38,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">
|
||||||
{isFetching ?
|
{getProductsData?.isPending ?
|
||||||
<>
|
<>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
@@ -40,10 +46,10 @@ export default function Products() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
: isError ?
|
: getProductsData?.isPending ?
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<p className='text-danger'>{error.message}</p>
|
<p className='text-danger'>{getProductsData?.error?.message}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
:
|
:
|
||||||
|
|||||||
@@ -85,23 +85,20 @@ export const recentActions = (reqData) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION TO GET DASHBOARD PRODUCT DATA SECTION
|
// FUNCTION TO GET DASHBOARD PRODUCT DATA SECTION
|
||||||
export const productData = () => {
|
export const productsData = (reqData) => {
|
||||||
let postData = {
|
let postData = {
|
||||||
"token":"b",
|
...reqData,
|
||||||
"uid": 'h'
|
|
||||||
}
|
}
|
||||||
return postAuxEnd(`/panel/account/products`, postData, false)
|
return postAuxEnd(`/panel/account/products`, postData, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// FUNCTION TO GET DASHBOARD PRODUCT URL DATA SECTION
|
// FUNCTION TO GET DASHBOARD PRODUCT URL DATA SECTION
|
||||||
export const productsURL = () => {
|
export const productsURL = () => {
|
||||||
return getAuxEnd(`/panel/account/products/url`)
|
return getAuxEnd(`/panel/account/products/url`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// FUNCTION TO REGISTER USER
|
// FUNCTION TO REGISTER USER
|
||||||
export const signUpUser = (reqData) => {
|
export const signUpUser = (reqData) => {
|
||||||
let postData = {
|
let postData = {
|
||||||
|
|||||||
Reference in New Issue
Block a user