load bin from user's list

This commit is contained in:
brian
2021-04-08 09:00:28 -04:00
parent 08f500f67d
commit fdbf3485de
2 changed files with 18 additions and 3 deletions
+14 -1
View File
@@ -69,6 +69,18 @@ const bin_name_commit_handler = function(state, dispatch){
api.post('/bin-rename', {bin_id:state.bin.id, name:state.temp_bin_name});
dispatch('commit-bin-name');
};
const choose_bin_handler = function(state, dispatch, bin_id){
window.history.pushState(null,'','#'+bin_id);
dispatch('bin-requested', bin_id);
api.post('/load-bin', {bin_id})
.then(res=>{
dispatch('bin-loaded', res.bin);
});
api.post('/load-notes', {bin_id})
.then(res=>{
dispatch('notes-loaded', res.notes);
});
};
export {new_note_handler,
search_term_change_handler,
@@ -81,5 +93,6 @@ export {new_note_handler,
logout_request_handler,
bin_name_editing_toggle_button_handler,
bin_name_change_handler,
bin_name_commit_handler
bin_name_commit_handler,
choose_bin_handler
};