Pack up functionality done

This commit is contained in:
Senad Uka
2020-10-21 15:11:20 +02:00
parent 25cfc6610c
commit 6f655dfe2b
11 changed files with 95 additions and 13 deletions

View File

@@ -5,6 +5,7 @@
"proxy": "http://localhost:3001",
"dependencies": {
"axios": "^0.19.0",
"js-file-download": "^0.4.12",
"materialize-css": "^1.0.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",

View File

@@ -5,6 +5,7 @@ import {errorToast} from "../common/errorHelpers";
import {withRouter} from 'react-router-dom';
import {GANGS} from "../RouteNames";
import M from 'materialize-css';
import fileDownload from 'js-file-download';
const GangDetails = (props) => {
const gang = props.gang;
@@ -13,6 +14,17 @@ const GangDetails = (props) => {
const disableSubmit = () => gangName.length === 0;
const getBackup = async () => {
try {
const response = await axios.get(`/api/gangs/${gang.id}/backup`);
const timestamp = Date.now();
const safeGangName = str.replace(/blue/g, "red");
fileDownload(response.data, `fil.csv`, 'text/csv')
} catch (e) {
console.log("EE ", e);
}
}
const updateGang = async () => {
const updatedGang = {
name: gangName
@@ -47,8 +59,17 @@ const GangDetails = (props) => {
Make it done
</Button>
</div>
<h1> Pack up </h1>
<div>
<p>
<Button onClick={getBackup}> Pack up </Button>
</p>
<p>
</p>
</div>
</div>
)
}
export default withRouter(GangDetails);
export default withRouter(GangDetails);

View File

@@ -59,4 +59,4 @@ const Gangs = (props) => {
)
}
export default withRouter(Gangs);
export default withRouter(Gangs);

View File

@@ -5555,6 +5555,11 @@ jest@24.7.1:
import-local "^2.0.0"
jest-cli "^24.7.1"
js-file-download@^0.4.12:
version "0.4.12"
resolved "https://registry.yarnpkg.com/js-file-download/-/js-file-download-0.4.12.tgz#10c70ef362559a5b23cdbdc3bd6f399c3d91d821"
integrity sha512-rML+NkoD08p5Dllpjo0ffy4jRHeY6Zsapvr/W86N7E0yuzAO6qa5X9+xog6zQNlH102J7IXljNY2FtS6Lj3ucg==
js-levenshtein@^1.1.3:
version "1.1.6"
resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d"