code7-leia 0.2.22 → 0.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.22",
2
+ "version": "0.2.23",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -1,5 +1,6 @@
1
1
  import React, { createContext, useContext, useEffect, useState } from 'react';
2
2
  import api from '../service/Api';
3
+ import apiHml from '../service/ApiHml';
3
4
 
4
5
  interface Props {
5
6
  id: string;
@@ -26,14 +27,14 @@ export const useSharedProps = () => {
26
27
  };
27
28
 
28
29
  export const SharedPropsProvider: React.FC<Props> = ({ children, ...props }) => {
29
- const { id, language } = props;
30
+ const { id, language, env } = props;
30
31
  const [tags, setTags] = useState<any>(null);
31
32
  const [personas, setPersonas] = useState<any>(null);
32
33
 
33
34
  useEffect(() => {
34
35
  const fetchData = async () => {
35
36
  try {
36
- const { data } = await api.get(`/tags/${id}`);
37
+ const { data } = env.toLowerCase() === 'prod' ? await api.get(`/tags/${id}`) : await apiHml.get(`/tags/${id}`);
37
38
 
38
39
  if (data) {
39
40
  setTags(data);
@@ -47,7 +48,7 @@ export const SharedPropsProvider: React.FC<Props> = ({ children, ...props }) =>
47
48
 
48
49
  const personas = async () => {
49
50
  try {
50
- const { data } = await api.get(`/personas?language=${language}`);
51
+ const { data } = env.toLowerCase() === 'prod' ? await api.get(`/personas?language=${language}`) : await apiHml.get(`/personas?language=${language}`);
51
52
 
52
53
  if (data) {
53
54
  setPersonas(data);