interation opengraph

This commit is contained in:
sebvtl728
2025-01-15 09:50:46 +01:00
parent 7c25479236
commit a9f17ff11f
7 changed files with 5105 additions and 51 deletions
+15 -1
View File
@@ -1,8 +1,22 @@
import axios from 'axios';
// Création de l'instance Axios
const api = axios.create({
baseURL: 'https://preprod.octopusdesign.fr/api-octopus/server/wp-json',
withCredentials: true,
});
export default api;
// Méthode pour récupérer les données OpenGraph d'un article spécifique
export const fetchPostWithOG = async (postId) => {
try {
const response = await api.get(`/wp/v2/posts/${postId}`);
const { opengraph } = response.data; // Les métadonnées OpenGraph doivent être disponibles ici
return opengraph;
} catch (error) {
console.error('Erreur lors de la récupération des données OpenGraph :', error);
throw error;
}
};
// Exportation de l'instance Axios par défaut
export default api;