en_btr_frontend/app/routes/commentary-article.js

14 lines
441 B
JavaScript

import Route from '@ember/routing/route';
import fetch from 'fetch';
import { htmlSafe } from '@ember/template';
export default class CommentaryArticleRoute extends Route {
async model(params) {
const response = await fetch(window.GwtFrontend.hostUrl + '/api/v1/commentary/articles/' + params.article_id);
const body = await response.text().then(function(text){
return new htmlSafe(text);
});
return { body };
}
}