File tree Expand file tree Collapse file tree
app/(dashboard)/admin/users Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"use client" ;
22import { CustomButton , DashboardSidebar } from "@/components" ;
3+ import apiClient from "@/lib/api" ;
34import { nanoid } from "nanoid" ;
45import Link from "next/link" ;
56import React , { useEffect , useState } from "react" ;
@@ -9,7 +10,7 @@ const DashboardUsers = () => {
910
1011 useEffect ( ( ) => {
1112 // sending API request for all users
12- fetch ( "http://localhost:3001 /api/users")
13+ apiClient . get ( " /api/users")
1314 . then ( ( res ) => {
1415 return res . json ( ) ;
1516 } )
Original file line number Diff line number Diff line change @@ -14,12 +14,13 @@ import Image from "next/image";
1414import Link from "next/link" ;
1515import React , { useEffect , useState } from "react" ;
1616import CustomButton from "./CustomButton" ;
17+ import apiClient from "@/lib/api" ;
1718
1819const DashboardProductTable = ( ) => {
1920 const [ products , setProducts ] = useState < Product [ ] > ( [ ] ) ;
2021
2122 useEffect ( ( ) => {
22- fetch ( "http://localhost:3001 /api/products?mode=admin", { cache : "no-store" } )
23+ apiClient . get ( " /api/products?mode=admin", { cache : "no-store" } )
2324 . then ( ( res ) => {
2425 return res . json ( ) ;
2526 } )
You can’t perform that action at this time.
0 commit comments