23 lines
512 B
TypeScript
23 lines
512 B
TypeScript
// src/api/deal/dealApi.ts
|
||
import instance from "../axiosInstance"
|
||
|
||
export async function getDeals(page = 1) {
|
||
try {
|
||
const { data } = await instance.get(`/deals?page=${page}`)
|
||
return data.results
|
||
} catch (error) {
|
||
console.error("Deal listesi hatası:", error)
|
||
throw error
|
||
}
|
||
}
|
||
|
||
export async function getDeal(id: number) {
|
||
try {
|
||
const { data } = await instance.get(`/deals/${id}`)
|
||
return data
|
||
} catch (error) {
|
||
console.error("Deal alma hatası:", error)
|
||
throw error
|
||
}
|
||
}
|