nfp_sites/nfp_moe/api/page_routes.mjs

19 lines
No EOL
600 B
JavaScript

import { parseArticles, parseArticle } from '../base/article/util.mjs'
import Parent from '../base/page/routes.mjs'
import { parsePage } from '../base/page/util.mjs'
import { combineFilesWithArticles } from './file/util.mjs'
export default class PageRoutes extends Parent {
getPage_resOut(res) {
let out = {
page: parsePage(res.results[0][0]),
articles: parseArticles(res.results[1]),
total_articles: res.results[2][0].total_articles,
featured: parseArticle(res.results[4][0]),
}
combineFilesWithArticles(out.articles, res.results[3])
return out
}
}