Skip to content

Commit 22494f1

Browse files
committed
replaced last fetches
1 parent 5364593 commit 22494f1

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

app/(dashboard)/admin/users/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22
import { CustomButton, DashboardSidebar } from "@/components";
3+
import apiClient from "@/lib/api";
34
import { nanoid } from "nanoid";
45
import Link from "next/link";
56
import 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
})

components/DashboardProductTable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ import Image from "next/image";
1414
import Link from "next/link";
1515
import React, { useEffect, useState } from "react";
1616
import CustomButton from "./CustomButton";
17+
import apiClient from "@/lib/api";
1718

1819
const 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
})

0 commit comments

Comments
 (0)