Merge branch 'devops-staging' of https://gitlab.com/empatnusabangsa/ppob/ppob-frontend
Conflicts: yarn.lock
This commit is contained in:
@@ -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,':)')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user