Fix JS crashing if initial-state is not set (#2193)

Fixes issues with the JS for at least sign-up pages not working
th-downstream
Claire 1 year ago committed by GitHub
parent 9cf595c779
commit f353e2b0b5

@ -96,10 +96,12 @@ const element = document.getElementById('initial-state');
const initialState = element?.textContent && JSON.parse(element.textContent); const initialState = element?.textContent && JSON.parse(element.textContent);
// Glitch-soc-specific “local settings” // Glitch-soc-specific “local settings”
try { if (initialState) {
initialState.local_settings = JSON.parse(localStorage.getItem('mastodon-settings')); try {
} catch (e) { initialState.local_settings = JSON.parse(localStorage.getItem('mastodon-settings'));
initialState.local_settings = {}; } catch (e) {
initialState.local_settings = {};
}
} }
/** /**

Loading…
Cancel
Save