Merge branch 'main' of https://gitlab.com/hanifsalafi/mediahub_redesign into dev-sabda-v2
This commit is contained in:
commit
399eef865f
|
|
@ -59,7 +59,7 @@ import {
|
||||||
deleteMediaBlastCampaignAccount,
|
deleteMediaBlastCampaignAccount,
|
||||||
saveMediaBlastCampaignAccountBulk,
|
saveMediaBlastCampaignAccountBulk,
|
||||||
} from "@/service/broadcast/broadcast";
|
} 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";
|
import { close, loading, error, success, successCallback } from "@/config/swal";
|
||||||
|
|
||||||
// Mock data for available accounts - replace with actual API call
|
// Mock data for available accounts - replace with actual API call
|
||||||
|
|
@ -246,14 +246,7 @@ const AccountListTable = () => {
|
||||||
const fetchUsersList = async () => {
|
const fetchUsersList = async () => {
|
||||||
try {
|
try {
|
||||||
loading();
|
loading();
|
||||||
const response = await AdministrationUserList(
|
const response = await getUserListAll();
|
||||||
"1", // levelId
|
|
||||||
0, // page
|
|
||||||
"", // name
|
|
||||||
"100", // size
|
|
||||||
"1", // featureId
|
|
||||||
"" // role
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response?.data?.data?.content) {
|
if (response?.data?.data?.content) {
|
||||||
setUsersList(response.data.data.content);
|
setUsersList(response.data.data.content);
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,8 @@ const useTableColumns = ({
|
||||||
loading();
|
loading();
|
||||||
|
|
||||||
const response = await downloadReport(id);
|
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");
|
const link = document.createElement("a");
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.setAttribute("download", `report-${id}.pdf`);
|
link.setAttribute("download", `report-${id}.pdf`);
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -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 pathname = window?.location.pathname;
|
||||||
const response = await axiosInterceptorInstance
|
const response = await axiosInterceptorInstance
|
||||||
.get(pathUrl)
|
.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(
|
export async function httpPostInterceptor(
|
||||||
pathUrl: any,
|
pathUrl: any,
|
||||||
data?: any,
|
data?: any,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@ import {
|
||||||
httpPostInterceptor,
|
httpPostInterceptor,
|
||||||
} from "../http-config/http-interceptor-service";
|
} from "../http-config/http-interceptor-service";
|
||||||
|
|
||||||
|
export async function getUserListAll() {
|
||||||
|
const url = `users/pagination/all?enablePage=0`;
|
||||||
|
return httpGetInterceptor(url);
|
||||||
|
}
|
||||||
|
|
||||||
export async function AdministrationUserList(
|
export async function AdministrationUserList(
|
||||||
id: string,
|
id: string,
|
||||||
page: number,
|
page: number,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import {
|
import {
|
||||||
httpGetInterceptor,
|
httpGetInterceptor,
|
||||||
|
httpGetWithBlobInterceptor,
|
||||||
httpPostInterceptor,
|
httpPostInterceptor,
|
||||||
} from "../http-config/http-interceptor-service";
|
} from "../http-config/http-interceptor-service";
|
||||||
|
|
||||||
|
|
@ -36,5 +37,5 @@ export async function saveUserReportsAction(id: any, action: any) {
|
||||||
|
|
||||||
export async function downloadReport(id: any) {
|
export async function downloadReport(id: any) {
|
||||||
const url = `/media/report/download?id=${id}`;
|
const url = `/media/report/download?id=${id}`;
|
||||||
return httpGetInterceptor(url);
|
return httpGetWithBlobInterceptor(url);
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue