all products page

This commit is contained in:
nabijonovdavronbek619@gmail.com
2025-12-11 19:14:35 +05:00
parent 6e41a836a7
commit b3cf0c2a49
2 changed files with 46 additions and 14 deletions

View File

@@ -1,13 +1,14 @@
import axios from "axios";
export const allProduct = async () => {
try{
const res = await axios.get('https://api.serenmebel.uz/api/products/');
console.log("all products res: ",res);
return res
}catch(err){
console.log("all product error: ",err);
return []
}
};
export async function GET() {
try {
const res = await axios.get("https://api.serenmebel.uz/api/products/");
console.log("all products res: ", res?.data);
return Response.json(res.data);
} catch (error: any) {
console.log("all products error: ", error);
return Response.json({ error: error.message });
}
}