fix(app/action): avoid dying when formats is not defined

This commit is contained in:
lowlighter
2022-03-09 19:34:30 -05:00
parent 3f1c2d42c5
commit 4d08563ee5

View File

@@ -18,7 +18,7 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
throw new Error("unsupported template") throw new Error("unsupported template")
const {image, style, fonts, views, partials} = conf.templates[template] const {image, style, fonts, views, partials} = conf.templates[template]
const computer = Templates[template].default || Templates[template] const computer = Templates[template].default || Templates[template]
convert = convert ?? conf.metadata.templates[template].formats[0] ?? null convert = convert ?? conf.metadata.templates[template]?.formats?.[0] ?? null
console.debug(`metrics/compute/${login} > output format set to ${convert}`) console.debug(`metrics/compute/${login} > output format set to ${convert}`)
//Initialization //Initialization