mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-10 20:38:32 +03:00
change linter to standard
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import StoreJson from "./models/StoreJson";
|
||||
import Fetcher from "./lib/Fetcher";
|
||||
import Controller from "./lib/Controller";
|
||||
import config from "./config";
|
||||
import StoreJson from './models/StoreJson'
|
||||
import Fetcher from './lib/Fetcher'
|
||||
import Controller from './lib/Controller'
|
||||
import config from './config'
|
||||
|
||||
const {googleSheets} = config;
|
||||
const {sheets, privateKey, email} = googleSheets;
|
||||
const { googleSheets } = config
|
||||
const { sheets, privateKey, email } = googleSheets
|
||||
|
||||
function authenticate(_fetcher) {
|
||||
function authenticate (_fetcher) {
|
||||
return _fetcher.fetcher.authenticate(email, privateKey).then(msg => {
|
||||
console.log(msg);
|
||||
return true;
|
||||
});
|
||||
console.log(msg)
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
export default callback => {
|
||||
@@ -18,29 +18,29 @@ export default callback => {
|
||||
return {
|
||||
name: sheet.name,
|
||||
fetcher: new Fetcher(new StoreJson(), sheet.name, sheet.id, sheet.tabs)
|
||||
};
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
Promise.all(fetchers.map(authenticate))
|
||||
.then(() => {
|
||||
console.log(`===================`);
|
||||
console.log(`grant access to: ${email}`);
|
||||
console.log(`===================`);
|
||||
console.log(`===================`)
|
||||
console.log(`grant access to: ${email}`)
|
||||
console.log(`===================`)
|
||||
|
||||
// NB: reformat fetchers as config for controller
|
||||
const config = {};
|
||||
const config = {}
|
||||
fetchers.forEach(fetcher => {
|
||||
config[fetcher.name] = fetcher.fetcher;
|
||||
});
|
||||
const controller = new Controller(config);
|
||||
callback(controller);
|
||||
config[fetcher.name] = fetcher.fetcher
|
||||
})
|
||||
const controller = new Controller(config)
|
||||
callback(controller)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
console.log(err)
|
||||
console.log(
|
||||
`ERROR: the server couldn't connect to all of the sheets you provided. Ensure you have granted access to ${
|
||||
email
|
||||
} on ALL listed sheets.`
|
||||
);
|
||||
});
|
||||
};
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user