[bugfix] Store /api/web/settings state locally for persistence (#2)
This also prevents the 'Can't verify CSRF token authenticity' errors that popup whenever you modify a 'web setting', such as the column layout. ~~NB: There is something funky going on. This works 99% of the time and sometimes doesn't?~~ Fixed now, there was two bits of stuff in verify_state doing the same thing, removed the duplicate. Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/2 Co-authored-by: julia <midnight@trainwit.ch> Co-committed-by: julia <midnight@trainwit.ch>
This commit is contained in:
@@ -26,9 +26,8 @@ const debouncedSave = debounce((dispatch, getState) => {
|
||||
|
||||
const data = getState().get('settings').filter((_, path) => path !== 'saved').toJS();
|
||||
|
||||
api(getState).put('/api/web/settings', { data })
|
||||
.then(() => dispatch({ type: SETTING_SAVE }))
|
||||
.catch(error => dispatch(showAlertForError(error)));
|
||||
localStorage.setItem('web_settings', JSON.stringify(data));
|
||||
dispatch({ type: SETTING_SAVE });
|
||||
}, 5000, { trailing: true });
|
||||
|
||||
export function saveSettings() {
|
||||
|
||||
Reference in New Issue
Block a user