Commit 482e3aad authored by Zac Wood's avatar Zac Wood

Web saves schedule as a file on generate

parent 35483d61
......@@ -10,6 +10,7 @@
"license": "Apache",
"private": true,
"devDependencies": {
"@types/file-saver": "^1.3.0",
"@types/node": "^9.6.6",
"awesome-typescript-loader": "^5.0.0",
"source-map-loader": "^0.2.3",
......
......@@ -2,6 +2,7 @@ import * as React from 'react';
import Section from '../section';
import SectionList from './SectionList';
import Search from './Search';
import * as FileSaver from 'file-saver';
interface State {
currentSchedule: Section[];
......@@ -33,7 +34,10 @@ class App extends React.Component<any, State> {
},
})
.then(response => response.text())
.then(text => console.log(text));
.then(text => {
const blob = new Blob([text], { type: 'text/plain;charset=utf-9' });
FileSaver.saveAs(blob, 'GMU Fall 2018.ics');
});
}
render() {
......
......@@ -6,6 +6,10 @@
version "0.7.0"
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
"@types/file-saver@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@types/file-saver/-/file-saver-1.3.0.tgz#0ef213077e704fc3f4e7a86cfd31c9de4f4f47a7"
"@types/node@*", "@types/node@^9.6.6":
version "9.6.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.6.tgz#439b91f9caf3983cad2eef1e11f6bedcbf9431d2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment