refactoring fetch datas
This commit is contained in:
parent
ed667c0c1a
commit
d5fefd3a86
|
|
@ -1,6 +1,6 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { useLanguage } from "./useLanguage";
|
||||
import axios from "axios";
|
||||
import { useUserContext } from "./useUserContext";
|
||||
|
||||
const BASE_URL = "http://lhoist-stay-safe.local/wp-json/wp/v2";
|
||||
const BASE_CUSTOM_URL = "http://lhoist-stay-safe.local/wp-json/lhoist-datas";
|
||||
|
|
@ -14,8 +14,8 @@ const umamiBaseEndpoint = process.env.REACT_APP_UMAMI_API_BASE_ENDPOINT;
|
|||
|
||||
function useWordpressCustomData(url) {
|
||||
const [data, setData] = useState();
|
||||
const { language } = useLanguage();
|
||||
const fullUrl = `${BASE_CUSTOM_URL}${url}?current-page-language=${language}`;
|
||||
const { language } = useUserContext();
|
||||
const fullUrl = `${BASE_CUSTOM_URL}${url}?current-language=${language}`;
|
||||
|
||||
useEffect(() => {
|
||||
const dataFetch = async () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user