mirror of
https://github.com/nasa/openmct.git
synced 2025-03-22 12:05:19 +00:00
Accept plans from a file OR from JSON object (couchDB) (#3729)
Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
This commit is contained in:
parent
03abb5e5de
commit
e70a636073
@ -1,10 +1,14 @@
|
||||
export function getValidatedPlan(domainObject) {
|
||||
let jsonString = domainObject.selectFile.body;
|
||||
let body = domainObject.selectFile.body;
|
||||
let json = {};
|
||||
try {
|
||||
json = JSON.parse(jsonString);
|
||||
} catch (e) {
|
||||
return json;
|
||||
if (typeof body === 'string') {
|
||||
try {
|
||||
json = JSON.parse(body);
|
||||
} catch (e) {
|
||||
return json;
|
||||
}
|
||||
} else {
|
||||
json = body;
|
||||
}
|
||||
|
||||
return json;
|
||||
|
Loading…
x
Reference in New Issue
Block a user