api fetch type fixed
This commit is contained in:
parent
4bb48e59fc
commit
517b8d43b1
|
|
@ -26,6 +26,7 @@ import { ContactData, Contact } from "../types/contact";
|
|||
import { Video } from "../types/video";
|
||||
import { Player, playerType } from "../types/players";
|
||||
import { About } from "../types/about";
|
||||
import { Structure } from "../types/structure";
|
||||
|
||||
export const getMainSliderData = (
|
||||
setState: React.Dispatch<SlideProps[]>
|
||||
|
|
@ -109,7 +110,7 @@ export const getVideos = (
|
|||
.catch();
|
||||
};
|
||||
|
||||
export const getStructure = (setState: any) => {
|
||||
export const getStructure = (setState: React.Dispatch<Structure[]>) => {
|
||||
axios
|
||||
.get(structure)
|
||||
.then((res) => {
|
||||
|
|
|
|||
|
|
@ -14,11 +14,31 @@ import { highlightColor } from "../helpers/otherVariables";
|
|||
// Links
|
||||
import { hosting } from "../links";
|
||||
|
||||
// Link: /structure
|
||||
// Types
|
||||
import { Structure } from "../types/structure";
|
||||
|
||||
const Structure = () => {
|
||||
const [structureData, setStructureData]: [any, React.Dispatch<any>] =
|
||||
useState();
|
||||
const [structureData, setStructureData]: [
|
||||
Structure[],
|
||||
React.Dispatch<Structure[]>
|
||||
] = useState([
|
||||
{
|
||||
id: -1,
|
||||
job: "",
|
||||
name: "",
|
||||
email: "",
|
||||
phone: "",
|
||||
facebook: "",
|
||||
img: "",
|
||||
translations: [
|
||||
{
|
||||
model_id: "",
|
||||
locale: "",
|
||||
attribute_data: "",
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
|
|
@ -27,12 +47,13 @@ const Structure = () => {
|
|||
useEffect(() => {
|
||||
getStructure(setStructureData);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<main className="structure">
|
||||
<div className="container">
|
||||
<div className="structure-inner">
|
||||
<SectionTitle title={"Структура федерации"} />
|
||||
{structureData ? (
|
||||
{structureData[0].id !== -1 ? (
|
||||
<div className="structure-content">
|
||||
{structureData.map((person: any) => {
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in New Issue