refuses to load private bins; fixed NodeJS startup error connectiong to Postgres

This commit is contained in:
brian
2021-04-13 00:52:57 -04:00
parent 8432255890
commit 555e33040b
8 changed files with 150 additions and 71 deletions
+21 -6
View File
@@ -10,7 +10,12 @@ const preventDblClickSelection = function(e){
const load_notes = function(state, dispatch){
api.post('/load-notes', {bin_id: state.bin_id})
.then(res=>{
dispatch('notes-loaded', res.notes);
if(res.success===true){
dispatch('notes-loaded', res.notes);
}
else if(res.authorized===false){
dispatch('notes-unauthorized');
}
});
};
const runSearch = function(state, dispatch){
@@ -86,11 +91,21 @@ const choose_bin_handler = function(state, dispatch, 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);
if(res.success===true){
dispatch('bin-loaded', res.bin);
api.post('/load-notes', {bin_id})
.then(res=>{
if(res.success===true && res.authorized===true){
dispatch('notes-loaded', res.notes);
}
else if(res.success===false && res.authorized===false){
dispatch('notes-unauthorized');
}
});
}
else if(res.success===false && res.authorized==false){
dispatch('bin-unauthorized');
}
});
};
+18 -4
View File
@@ -3,11 +3,18 @@ import api from '../api.js';
const initial_load_bin_handler = function(state, dispatch, bin_id){
api.post('/load-bin', {bin_id})
.then(res => {
dispatch('bin-loaded', res.bin);
if(res.success===false && res.authorized===false){
dispatch('bin-unauthorized');
}
else{
dispatch('bin-loaded', res.bin);
}
});
api.post('/load-notes', {bin_id})
.then(res => {
dispatch('notes-loaded', res.notes);
if(res.success===true){
dispatch('notes-loaded', res.notes);
}
});
};
@@ -22,11 +29,18 @@ const hash_change_handler = function(state, dispatch, e){
dispatch('bin-requested', bin_id);
api.post('/load-bin', {bin_id})
.then(res=>{
dispatch('bin-loaded', res.bin);
if(res.success==true){
dispatch('bin-loaded', res.bin);
}
else if(res.authorized===false){
dispatch('bin-unauthorized');
}
});
api.post('/load-notes', {bin_id})
.then(res => {
dispatch('notes-loaded', res.notes);
if(res.success==true){
dispatch('notes-loaded', res.notes);
}
});
}
};