began username/password/bin-renaming

This commit is contained in:
brian
2021-04-06 09:02:33 -04:00
parent 27861adeb8
commit d7e0d4ffd4
4 changed files with 99 additions and 11 deletions
+39 -1
View File
@@ -34,5 +34,43 @@ const new_bin_handler = function(state, dispatch){
window.history.pushState(null,'','#'+id);
dispatch('new-bin', {id});
};
const username_change_handler = function(state, dispatch, e){
dispatch('update-username', e.target.value);
};
const password_change_handler = function(state, dispatch, e){
dispatch('update-password', e.target.value);
};
const login_request_handler = function(state, dispatch, e){
dispatch('login-requested');
api.post('/login', {username: state.login.username, password: state.login.password})
.then(res=>{
if(res.success===true){
dispatch('login-succeeded', res.user, res.session_id);
}
else{
dispatch('login-failed');
}
});
};
const bin_name_editing_toggle_button_handler = function(state, dispatch){
dispatch('update-bin-name-editing', !state.is_editing_bin_name);
};
const bin_name_change_handler = function(state, dispatch, e){
dispatch('update-bin-name', e.target.value);
};
const bin_name_commit_handler = function(state, dispatch){
dispatch('commit-bin-name');
};
export {new_note_handler, search_term_change_handler, sorting_change_handler, load_notes, new_bin_handler};
export {new_note_handler,
search_term_change_handler,
sorting_change_handler,
load_notes,
new_bin_handler,
username_change_handler,
password_change_handler,
login_request_handler,
bin_name_editing_toggle_button_handler,
bin_name_change_handler,
bin_name_commit_handler
};