make downloaded JSON readable

This commit is contained in:
Jon Eugster
2023-07-24 12:11:31 +02:00
parent 491d56a9d6
commit 04c19f36cf
2 changed files with 2 additions and 2 deletions
@@ -81,7 +81,7 @@ export function WorldSelectionMenu() {
const downloadProgress = (e) => { const downloadProgress = (e) => {
e.preventDefault() e.preventDefault()
downloadFile({ downloadFile({
data: JSON.stringify(gameProgress), data: JSON.stringify(gameProgress, null, 2),
fileName: `lean4game-${gameId}-${new Date().toLocaleDateString()}.json`, fileName: `lean4game-${gameId}-${new Date().toLocaleDateString()}.json`,
fileType: 'text/json', fileType: 'text/json',
}) })
+1 -1
View File
@@ -25,7 +25,7 @@ export function loadState() {
/** Save to browser storage */ /** Save to browser storage */
export async function saveState(state: any) { export async function saveState(state: any) {
try { try {
const serializedState = JSON.stringify(state); const serializedState = JSON.stringify(state)
localStorage.setItem(KEY, serializedState); localStorage.setItem(KEY, serializedState);
} catch (e) { } catch (e) {
// Ignore // Ignore