Conflicts:
	yarn.lock
This commit is contained in:
Fadli
2023-01-04 01:17:23 +07:00
5 changed files with 9626 additions and 9044 deletions

View File

@@ -1,5 +1,11 @@
import { makeAutoObservable } from "mobx";
import { http } from "../utils/http";
import { binaryStringToArrayBuffer, arrayBufferToBlob } from 'blob-util'
import axios from "axios";
import {appConfig} from "../config/app";
import fileDownload from "react-file-download";
import {TokenUtil} from "../utils/token";
import {message} from "antd";
export class Transaction {
page = 0;
@@ -267,4 +273,27 @@ export class Transaction {
console.error(e);
}
}
exportTransaction(data,date) {
try {
axios({
url: appConfig.apiUrl + `/excel/history-user/export/${data.id}`,
headers: {"Authorization" : `Bearer ${TokenUtil.accessToken}`},
method: 'POST',
data: date,
responseType: 'blob'
}).then((response) => {
var fileDownload = require('react-file-download');
message.success("Success export");
fileDownload(response.data, `Mutasi Transaki ${data.userDetail.name} ${date.dateStart}.xlsx`);
return fileDownload;
}).catch(function (error) {
message.error("No data to export");
return error;
});
} catch (e) {
console.error(e,':)')
}
}
}