feat: init modal loader components
This commit is contained in:
parent
61ec562ca4
commit
1bf45213de
|
@ -1,5 +1,5 @@
|
|||
import React, {useContext, useEffect, useState} from "react";
|
||||
import {Button, Card, Col, Input, Row, Select, Tabs, Upload} from "antd";
|
||||
import React, {useContext, useEffect} from "react";
|
||||
import {Button, Card, Col, Input, Row, Upload} from "antd";
|
||||
import {FilterOutlined, PlusSquareOutlined, UploadOutlined,} from "@ant-design/icons";
|
||||
import {BreadcumbComponent} from "../../component/BreadcumbComponent";
|
||||
import {useStore} from "../../utils/useStore";
|
||||
|
@ -8,19 +8,15 @@ import {ProductComponent} from "../../component/ProductComponent";
|
|||
import {LINKS} from "../../routes/app";
|
||||
import {ModalLoaderContext} from "../../utils/modal";
|
||||
|
||||
const {TabPane} = Tabs;
|
||||
const {Search} = Input;
|
||||
const {Option} = Select;
|
||||
|
||||
export const Product = observer(() => {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const store = useStore();
|
||||
const modalLoader = useContext(ModalLoaderContext);
|
||||
|
||||
useEffect(() => {
|
||||
const init = async () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
modalLoader.setLoading(true);
|
||||
await Promise.allSettled([
|
||||
store.supplier.getData(),
|
||||
|
@ -28,10 +24,9 @@ export const Product = observer(() => {
|
|||
store.category.getData(),
|
||||
]);
|
||||
await store.product.getData();
|
||||
setIsLoading(false);
|
||||
modalLoader.setLoading(false);
|
||||
} catch (e) {
|
||||
setIsLoading(false);
|
||||
modalLoader.setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user