feat: preview

This commit is contained in:
wuyue.xht 2020-04-22 18:45:11 +08:00
parent f734a612b2
commit abeb2ba83f

View File

@ -10,7 +10,18 @@ const SamplePreview = ({ editor }: PluginProps) => {
if (designer) {
console.info('save schema:', designer.schema);
localStorage.setItem('lce-dev-store', JSON.stringify(designer.schema));
window.open('http://30.5.157.206:3333/', 'preview');
fetch('http://30.5.157.206:3000/legao/save.json', {
method: 'POST',
body: JSON.stringify(designer.schema),
headers: new Headers({
'Content-Type': 'application/json',
}),
mode: 'cors',
})
.then((res) => res.json())
.then(() => {
window.open('http://30.5.157.206:3333/', 'preview');
});
}
};