fix signed out users
This commit is contained in:
parent
6c6af8e4f3
commit
3e9e076c0b
|
@ -95,7 +95,7 @@ export default class Store extends EventEmitter {
|
|||
get(path, cb) {
|
||||
let val = opa.get(this[DATA], path);
|
||||
if (!_.isFunction(cb)) return val;
|
||||
|
||||
|
||||
if (opa.has(this[DATA], path)) return cb(val);
|
||||
|
||||
// TODO: unit-test.
|
||||
|
|
|
@ -32,7 +32,7 @@ export default {
|
|||
if (!isValid(args)) return cb('Request is malformed');
|
||||
let { owner, name } = args;
|
||||
|
||||
let token = (user.github != null) ? user.github.accessToken : null;
|
||||
let token = (user && user.github != null) ? user.github.accessToken : null;
|
||||
let data = _.defaults({
|
||||
'path': `/repos/${owner}/${name}`,
|
||||
'headers': headers(token)
|
||||
|
@ -46,7 +46,7 @@ export default {
|
|||
if (!isValid(args)) return cb('Request is malformed');
|
||||
let { owner, name } = args;
|
||||
|
||||
let token = (user.github != null) ? user.github.accessToken : null;
|
||||
let token = (user && user.github != null) ? user.github.accessToken : null;
|
||||
let data = _.defaults({
|
||||
'path': `/repos/${owner}/${name}/milestones`,
|
||||
'query': { 'state': 'open', 'sort': 'due_date', 'direction': 'asc' },
|
||||
|
@ -61,7 +61,7 @@ export default {
|
|||
if (!isValid(args)) return cb('Request is malformed');
|
||||
let { owner, name, milestone } = args;
|
||||
|
||||
let token = (user.github != null) ? user.github.accessToken : null;
|
||||
let token = (user && user.github != null) ? user.github.accessToken : null;
|
||||
let data = _.defaults({
|
||||
'path': `/repos/${owner}/${name}/milestones/${milestone}`,
|
||||
'query': { 'state': 'open', 'sort': 'due_date', 'direction': 'asc' },
|
||||
|
@ -76,7 +76,7 @@ export default {
|
|||
if (!isValid(args)) return cb('Request is malformed');
|
||||
let { owner, name, milestone } = args;
|
||||
|
||||
let token = (user.github != null) ? user.github.accessToken : null;
|
||||
let token = (user && user.github != null) ? user.github.accessToken : null;
|
||||
let data = _.defaults({
|
||||
'path': `/repos/${owner}/${name}/issues`,
|
||||
'query': _.extend(query, { milestone, 'per_page': '100' }),
|
||||
|
|
|
@ -16,9 +16,8 @@ class AppStore extends Store {
|
|||
constructor() {
|
||||
super({
|
||||
'system': {
|
||||
'loading': false,
|
||||
},
|
||||
'user': {}
|
||||
'loading': false
|
||||
}
|
||||
});
|
||||
|
||||
// Listen to all app actions.
|
||||
|
@ -60,7 +59,7 @@ class AppStore extends Store {
|
|||
|
||||
// Called by Firebase.
|
||||
onUserReady(user) {
|
||||
this.set('user', user || {});
|
||||
this.set('user', user);
|
||||
}
|
||||
|
||||
onSystemLoading(state) {
|
||||
|
|
|
@ -82,7 +82,7 @@ class ProjectsStore extends Store {
|
|||
})) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// OK fetch all the issues for this milestone then.
|
||||
issues.fetchAll(user, {
|
||||
'owner': project.owner,
|
||||
|
@ -241,8 +241,6 @@ class ProjectsStore extends Store {
|
|||
// Sort projects (update the index). Can pass reference to the
|
||||
// project and milestone index in the stack.
|
||||
sort(ref, data) {
|
||||
//console.log(ref, data);
|
||||
|
||||
let idx;
|
||||
// Get the existing index.
|
||||
let index = this.get('index');
|
||||
|
|
Loading…
Reference in New Issue