Commit e18bc31d authored by Varunkumar Manohar's avatar Varunkumar Manohar
Browse files

use undefined if sub and subid does not exist

parent 21d6ccaa
Pipeline #57227 failed with stages
in 11 minutes and 40 seconds
......@@ -45,13 +45,9 @@ export class DatasetParser {
const dataset = this.createDatasetModelFromRequest(req);
dataset.ltag = (req.headers.ltag) as string;
dataset.type = req.body ? req.body.type : undefined;
const jwtSubID = Utils.getSubIDFromPayload(req.headers.authorization);
if (jwtSubID) {
dataset.created_by = jwtSubID;
} else {
dataset.created_by = Utils.getSubFromPayload(req.headers.authorization);
}
dataset.created_by = Utils.getSubIDFromPayload(req.headers.authorization) ||
Utils.getSubFromPayload(req.headers.authorization) ||
undefined;
dataset.created_date = dataset.last_modified_date = new Date().toString();
dataset.gtags = req.body ? req.body.gtags : undefined;
......
......@@ -152,12 +152,9 @@ export class SubProjectHandler {
subproject.storage_location, subproject.storage_class);
const subprojectCreatorEmail = subproject.admin || userEmail;
const jwtSubID = Utils.getSubIDFromPayload(req.headers.authorization);
if (jwtSubID) {
subproject.admin = jwtSubID;
} else {
subproject.admin = Utils.getSubFromPayload(req.headers.authorization);
}
subproject.admin = Utils.getSubIDFromPayload(req.headers.authorization) ||
Utils.getSubFromPayload(req.headers.authorization) || undefined;
// Register the subproject
await SubProjectDAO.register(journalClient, subproject);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment