save jsl data

This commit is contained in:
Jan Prochazka
2023-02-25 11:34:19 +01:00
parent a77492440e
commit 1c73920dd5
5 changed files with 108 additions and 31 deletions

View File

@@ -5,13 +5,18 @@ import openNewTab from './openNewTab';
export async function openJsonLinesData(rows) {
const jslid = uuidv1();
await apiCall('jsldata/save-rows', { jslid, rows });
openNewTab({
tabComponent: 'ArchiveFileTab',
icon: 'img archive',
title: 'Data #',
props: {
jslid,
// await apiCall('jsldata/save-rows', { jslid, rows });
openNewTab(
{
tabComponent: 'ArchiveFileTab',
icon: 'img archive',
title: 'Data #',
props: {
jslid,
},
},
});
{
rows,
}
);
}

View File

@@ -65,7 +65,7 @@ export default async function openNewTab(newTab, initialData = undefined, option
const tabid = uuidv1();
if (initialData) {
for (const key of _.keys(initialData)) {
if (key == 'editor') {
if (key == 'editor' || key == 'rows') {
await localforage.setItem(`tabdata_${key}_${tabid}`, initialData[key]);
} else {
localStorage.setItem(`tabdata_${key}_${tabid}`, JSON.stringify(initialData[key]));