fix opening sketches

from
- on drop
- index.js
This commit is contained in:
Casper Lamboo 2018-02-21 12:29:33 +01:00
parent 63b33c69b9
commit 6b6b860c4a
2 changed files with 5 additions and 5 deletions

View File

@ -55,8 +55,8 @@ window.downloadSketch = () => {
// add model to store // add model to store
import modelData from './models/circle_error.d3sketch'; import modelData from './models/circle_error.d3sketch';
import JSONToSketchData from './src/shape/JSONToSketchData.js'; import JSONToSketchData from './src/shape/JSONToSketchData.js';
JSONToSketchData(JSON.parse(modelData)).then(sketch => { JSONToSketchData(JSON.parse(modelData)).then(data => {
store.dispatch(actions.openSketch(sketch)); store.dispatch(actions.openSketch({ data }));
}); });
// default css // default css

View File

@ -106,9 +106,9 @@ class App extends React.Component {
case 'D3SKETCH': case 'D3SKETCH':
case 'JSON': case 'JSON':
const url = URL.createObjectURL(file); const url = URL.createObjectURL(file);
const data = await fetch(url).then(result => result.json()); const json = await fetch(url).then(result => result.json());
const sketchData = await JSONToSketchData(data); const data = await JSONToSketchData(json);
openSketch(sketchData); openSketch({ data });
break; break;
case 'JPG': case 'JPG':
case 'JPEG': case 'JPEG':