Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
fixes overloading api calls choojs/bankai#226
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyklee committed Apr 26, 2019
1 parent 019035d commit 855c0d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 64 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ app.route('/*', require('./views/404'))

if (typeof window !== 'undefined') {
document.body.appendChild(app.start())
app.mount('body')
}

module.exports = app.mount('body')
module.exports = app
63 changes: 3 additions & 60 deletions stores/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ state.main = {
// });


emitter.on('DOMContentLoaded', function () {
// emitter.on('DOMContentLoaded', function () {
emitter.on('LISTS_FIND', listsApi.find)
emitter.on('LISTS_FIND_MORE', listsApi.findMore);
emitter.on('LISTS_GET', (query) => {
Expand Down Expand Up @@ -218,7 +218,7 @@ state.main = {
state.main.selected.user.links = result;
emitter.emit('render');
}).catch(err => {
console.log(err);
console(err);
return err;
})

Expand Down Expand Up @@ -251,7 +251,7 @@ state.main = {

})

})
// })


function setQueryUserid(userid){
Expand Down Expand Up @@ -290,60 +290,3 @@ state.main = {


}


/**
let findFollowers = {
query:{
"followers": {
"$in": []
}
}
}
let findUserFollowers = {
query:{
"following": {
"$in": []
}
}
}
findFollowers.query.followers.$in = [state.selectedUser.profile._id];
return state.api.lists.find(findFollowers)
state.api.users.find(findByUsername)
.then(result => {
state.selectedUser.profile = result.data[0];
queryParams.query.$or[0].owner = state.selectedUser.profile._id;
queryParams.query.$or[1].collaborators.$in = [state.selectedUser.profile._id];
return state.api.links.find(queryParams)
})
.then(result => {
state.selectedUser.links = result.data;
return state.api.lists.find(queryParams)
})
.then(result => {
state.selectedUser.lists = result.data;
findFollowers.query.followers.$in = [state.selectedUser.profile._id];
return state.api.lists.find(findFollowers)
})
.then(result => {
state.selectedUser.listsFollowing = result.data;
findUserFollowers.query.following.$in = [state.selectedUser.profile._id];
return state.api.users.find(findUserFollowers)
})
.then(result => {
state.selectedUser.followers = result.data;
emitter.emit('render');
})
.catch(err =>{
alert(err);
})
*/
4 changes: 2 additions & 2 deletions stores/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function store(state, emitter) {
state.events.USER_SENDVERIFICATIONTOKEN = 'USER_SENDVERIFICATIONTOKEN';

// Events
emitter.on("DOMContentLoaded", () => {
// emitter.on("DOMContentLoaded", () => {
// when the DOM loads
auth.checkLogin();
emitter.on(state.events.USER_SIGNUP, auth.signup)
Expand All @@ -177,7 +177,7 @@ function store(state, emitter) {
emitter.on(state.events.USER_RESETPASSWORD, auth.resetPassword)
emitter.on(state.events.USER_SENDRESETPASSWORD, auth.sendResetPassword)
emitter.on(state.events.USER_SENDVERIFICATIONTOKEN, auth.sendVerificationToken)
})
// })


// Doers
Expand Down

0 comments on commit 855c0d8

Please sign in to comment.