Introduce store helper

Responsible for serializing/deserializing data to be saved in
localStorage. Add a prefix to all localStorage entries to avoid
conflicts with other webapps. Stop guarding against localStorage
not existing, browsers can just implement a dumb interface to
disable it.
This commit is contained in:
Simon Ser 2021-05-26 18:43:11 +02:00
parent 12a38ace90
commit 695b02caaa
4 changed files with 62 additions and 33 deletions

View file

@ -74,17 +74,6 @@ export default class ConnectForm extends Component {
}
render() {
var rememberMe = null;
if (window.localStorage) {
rememberMe = html`
<label>
<input type="checkbox" name="rememberMe" checked=${this.state.rememberMe} disabled=${this.props.disabled}/>
Remember me
</label>
<br/><br/>
`;
}
return html`
<form onChange=${this.handleChange} onSubmit=${this.handleSubmit}>
<h2>Connect to IRC</h2>
@ -101,7 +90,11 @@ export default class ConnectForm extends Component {
</label>
<br/><br/>
${rememberMe}
<label>
<input type="checkbox" name="rememberMe" checked=${this.state.rememberMe} disabled=${this.props.disabled}/>
Remember me
</label>
<br/><br/>
<details>
<summary>Advanced options</summary>