livebook/assets/js/user_form/index.js
Jonatan Kłosko 5c8e117800
Setup user profiles (#253)
* Add initial user config modal

* Assign user ids

* Update session data to hold user ids

* Get users list for specific ids

* Render user avatar

* User update

* Refactor user changes

* Subscribe to individual user updates

* Show users in side panel

* Add sidebar to homepage

* Don't generate the same color twice in a row

* Add documentation notes

* Fix tests

* Add tests

* Keep users in session data

* Rename color to hex_color
2021-05-03 20:03:19 +02:00

20 lines
518 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.data_name.value;
const hex_color = this.el.data_hex_color.value;
storeUserData({ name, hex_color });
});
},
};
export default UserForm;