feat: update broadcast conig and dashboard report

This commit is contained in:
hanif salafi 2025-09-27 12:25:36 +07:00
parent 745c0b72f2
commit b163084dfe
6 changed files with 18058 additions and 90 deletions

View File

@ -59,7 +59,7 @@ import {
deleteMediaBlastCampaignAccount,
saveMediaBlastCampaignAccountBulk,
} from "@/service/broadcast/broadcast";
import { AdministrationUserList } from "@/service/management-user/management-user";
import { AdministrationUserList, getUserListAll } from "@/service/management-user/management-user";
import { close, loading, error, success, successCallback } from "@/config/swal";
// Mock data for available accounts - replace with actual API call
@ -246,14 +246,7 @@ const AccountListTable = () => {
const fetchUsersList = async () => {
try {
loading();
const response = await AdministrationUserList(
"1", // levelId
0, // page
"", // name
"100", // size
"1", // featureId
"" // role
);
const response = await getUserListAll();
if (response?.data?.data?.content) {
setUsersList(response.data.data.content);

View File

@ -130,7 +130,8 @@ const useTableColumns = ({
loading();
const response = await downloadReport(id);
const url = window.URL.createObjectURL(new Blob([response?.data]));
console.log(response?.data);
const url = window.URL.createObjectURL(new Blob([response?.data], { type : "application/pdf"}));
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", `report-${id}.pdf`);

18091
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@ export async function httpGetInterceptorForMetadata(pathUrl: any) {
}
}
export async function httpGetInterceptor(pathUrl: any) {
export async function httpGetInterceptor(pathUrl: any, headers?: any) {
const pathname = window?.location.pathname;
const response = await axiosInterceptorInstance
.get(pathUrl)
@ -61,6 +61,39 @@ export async function httpGetInterceptor(pathUrl: any) {
}
}
export async function httpGetWithBlobInterceptor(pathUrl: any, headers?: any) {
const pathname = window?.location.pathname;
const response = await axiosInterceptorInstance
.get(pathUrl, { responseType: "blob" })
.catch((error) => error.response);
console.log("Response interceptor : ", response);
if (response?.status == 200 || response?.status == 201) {
return {
error: false,
message: "success",
data: response?.data,
};
} else if (response?.status == 401) {
Object.keys(Cookies.get()).forEach((cookieName) => {
Cookies.remove(cookieName);
});
if (
pathname?.includes("/contributor/") ||
pathname?.includes("/admin/") ||
pathname?.includes("/supervisor/")
) {
window.location.href = "/";
}
} else {
return {
error: true,
message: response?.data?.message || response?.data || null,
data: null,
};
}
}
export async function httpPostInterceptor(
pathUrl: any,
data?: any,

View File

@ -4,6 +4,11 @@ import {
httpPostInterceptor,
} from "../http-config/http-interceptor-service";
export async function getUserListAll() {
const url = `users/pagination/all?enablePage=0`;
return httpGetInterceptor(url);
}
export async function AdministrationUserList(
id: string,
page: number,

View File

@ -1,5 +1,6 @@
import {
httpGetInterceptor,
httpGetWithBlobInterceptor,
httpPostInterceptor,
} from "../http-config/http-interceptor-service";
@ -36,5 +37,5 @@ export async function saveUserReportsAction(id: any, action: any) {
export async function downloadReport(id: any) {
const url = `/media/report/download?id=${id}`;
return httpGetInterceptor(url);
return httpGetWithBlobInterceptor(url);
}