livebook/assets/js/user_form/index.js
Jonatan Kłosko c1654345b7
Migrate to latest LV (#437)
* Update phoenix deps

* Update reference to LiveDashboard encode_pid

* Fix form input id references

* Move to HEEx

* Update back to filesystem LV npm package

* Further HEEx rewrites

* Refactor icons into function components

* .html.leex -> .html.heex

* Further refactoring

* Move render helpers into function components

* Add doctype back

* Further refactoring

* Refactor cell component

* Further refactoring

* Compose sidebar using function components

* Rewrite notebook card component as function component

* Fruther refactoring

* Fix race condition in runtime tests

* Rewrite tooltips into function component

* Update Tailwind purge rules

* Revert "Rewrite tooltips into function component"

This reverts commit bd6ca8f0b5.

* Refactor conditional tooltip
2021-07-07 14:32:49 +02:00

20 lines
528 B
JavaScript

import { storeUserData } from "../lib/user";
/**
* A hook for the user profile form.
*
* On submit this hook saves the new data into cookie.
* This cookie serves as a backup and can be used to restore
* user data if the server is restarted.
*/
const UserForm = {
mounted() {
this.el.addEventListener("submit", (event) => {
const name = this.el.user_form_name.value;
const hex_color = this.el.user_form_hex_color.value;
storeUserData({ name, hex_color });
});
},
};
export default UserForm;