Fix: - app/(application)/(user)/investment/(tabs)/index.tsx - app/(application)/admin/investment/[id]/[status]/transaction-detail.tsx - app/(application)/admin/investment/[id]/list-of-investor.tsx - screens/Invesment/BoxBerandaSection.tsx - screens/Invesment/DetailDataPublishSection.tsx - service/api-admin/api-admin-investment.ts ### No Issue
89 lines
1.7 KiB
TypeScript
89 lines
1.7 KiB
TypeScript
import { apiConfig } from "../api-config";
|
|
|
|
export async function apiAdminInvestment({
|
|
category,
|
|
search,
|
|
}: {
|
|
category: "dashboard" | "publish" | "review" | "reject";
|
|
search?: string;
|
|
}) {
|
|
const propsQuery =
|
|
category === "dashboard"
|
|
? `category=${category}`
|
|
: `category=${category}&search=${search}`;
|
|
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/admin/investment?${propsQuery}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiAdminInvestmentDetailById({ id }: { id: string }) {
|
|
try {
|
|
const response = await apiConfig.get(`/mobile/admin/investment/${id}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiAdminInvestasiUpdateByStatus({
|
|
id,
|
|
status,
|
|
data,
|
|
}: {
|
|
id: string;
|
|
status: "publish" | "review" | "reject";
|
|
data: any;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.put(
|
|
`/mobile/admin/investment/${id}?status=${status}`,
|
|
{
|
|
data: data,
|
|
}
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiAdminInvestmentListOfInvestor({
|
|
id,
|
|
status,
|
|
}: {
|
|
id: string;
|
|
status: "berhasil" | "gagal" | "proses" | "menunggu" | null;
|
|
}) {
|
|
const query = status && status !== null ? `?status=${status}` : "";
|
|
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/admin/investment/${id}/investor${query}`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
export async function apiAdminInvestmentGetOneInvoiceById({
|
|
id,
|
|
}: {
|
|
id: string;
|
|
}) {
|
|
try {
|
|
const response = await apiConfig.get(
|
|
`/mobile/admin/investment/${id}/invoice`
|
|
);
|
|
return response.data;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|