feat(client): restore settings on reload

This commit is contained in:
Julien Oculi 2024-06-25 16:03:40 +02:00
parent 3781d07a8c
commit 49e32d5bf1

View file

@ -1,4 +1,8 @@
import { controlButtonHandler, keyboardHandler, settingsHandler } from './src/handlers.js'
import {
controlButtonHandler,
keyboardHandler,
settingsHandler,
} from './src/handlers.js'
import { assignCommands } from './src/utils.js'
// Input handlers
@ -25,3 +29,11 @@ document.addEventListener('keydown', keyboardHandler)
// Settings handler
document.querySelector('#settings').addEventListener('submit', settingsHandler)
// Restore endpoint if available
const endpoint = sessionStorage.getItem('robot-endpoint')
if (endpoint) {
document.querySelector('input[name=ip-address]').value = new URL(
endpoint
).host
}