Some changes
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
50c6c2d87b
commit
e826cdfee4
|
@ -4,6 +4,7 @@ const config = require('../config');
|
|||
const fallbackLocale = config.i18n.fallbackLocale;
|
||||
const userLocale = {
|
||||
async serverPrefetch() {
|
||||
console.log(this.auth);
|
||||
if (this.clientId)
|
||||
this.locale = await this.getLocale(this.clientId);
|
||||
|
||||
|
@ -24,8 +25,7 @@ const userLocale = {
|
|||
});
|
||||
}
|
||||
},
|
||||
props: ['clientId']
|
||||
props: ['auth', 'clientId']
|
||||
};
|
||||
|
||||
|
||||
Vue.mixin(userLocale);
|
||||
|
|
|
@ -28,6 +28,11 @@ module.exports = app => {
|
|||
if (!authToken || isTokenExpired(authToken.created, authToken.ttl))
|
||||
throw new Error('Invalid authorization token');
|
||||
|
||||
request.body.auth = {
|
||||
userId: authToken.userId,
|
||||
token: authorization
|
||||
};
|
||||
|
||||
next();
|
||||
} catch (error) {
|
||||
next(error);
|
||||
|
|
|
@ -2,17 +2,12 @@ const Report = require('../core/report');
|
|||
|
||||
module.exports = app => {
|
||||
app.get(`/api/report/:name`, async(req, res, next) => {
|
||||
const args = req.query;
|
||||
const requiredArgs = ['clientId'];
|
||||
const argList = requiredArgs.join(',');
|
||||
const hasRequiredArgs = requiredArgs.every(arg => {
|
||||
return args[arg];
|
||||
});
|
||||
const query = req.query;
|
||||
const body = re.body;
|
||||
const args = Object.assign({}, req.query);
|
||||
// merge params
|
||||
|
||||
try {
|
||||
if (!hasRequiredArgs)
|
||||
throw new Error(`Required properties not found [${argList}]`);
|
||||
|
||||
const reportName = req.params.name;
|
||||
const fileName = getFileName(reportName, args);
|
||||
const report = new Report(reportName, args);
|
||||
|
|
Loading…
Reference in New Issue