Skip to content

Commit

Permalink
tech: prévisualisation d'un article via l'api du back (#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlamande authored Feb 3, 2025
1 parent e3b2a4f commit 91f52e2
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/domaines/article/adapters/article.repository.axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,27 +90,27 @@ export class ArticleRepositoryAxios implements ArticleRepository {
}

async previsualiser(articleId: string): Promise<Article> {
const axiosCMS = AxiosFactory.getCMSAxios();
const article = await axiosCMS.get(
`/articles/${articleId}?populate[0]=partenaire,partenaire.logo.media&populate[1]=sources`,
);
const axios = AxiosFactory.getAxios();
const article = await axios.get(`/bibliotheque/articles/${articleId}`);

return {
id: articleId,
texte: article.data.data.attributes.contenu,
titre: article.data.data.attributes.titre,
sousTitre: article.data.data.attributes.sousTitre,
estEnFavori: false,
texte: article.data.contenu,
titre: article.data.titre,
sousTitre: article.data.soustitre,
sources:
article.data.data.attributes.sources?.map(source => ({
label: source.libelle,
url: source.lien,
article.data.sources?.map(source => ({
label: source.label,
url: source.url,
})) || null,
partenaire: article.data.data.attributes.partenaire.data
? {
nom: article.data.data.attributes.partenaire.data.attributes.nom,
logo: article.data.data.attributes.partenaire.data.attributes.logo.data[0].attributes.url,
}
: null,
partenaire:
article.data.partenaire_nom && article.data.partenaire_logo_url
? {
nom: article.data.partenaire_nom,
logo: article.data.partenaire_logo_url,
}
: null,
estEnFavori: article.data.favoris,
};
}
}

0 comments on commit 91f52e2

Please sign in to comment.