Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current none :
/
var
/
www
/
html
/
tpid-konsulin
/
konsulin-cust-react
/
src
/
views
/
Or
Select Your none :
Upload File :
New :
File
Dir
/var/www/html/tpid-konsulin/konsulin-cust-react/src/views/HomeParent.tsx
import images from 'assets/images' import { MenuBottom } from 'components' import { API } from 'config/api' import { useGlobalContext } from 'hooks/context' import { useGet } from 'hooks/useRequest' import React, { useEffect, useState } from 'react' import { Route, Routes } from 'react-router-dom' import { History, Home, NotificationParent, Profile, Store } from 'views' const MENU = [ { to: '/home' }, { to: '/notification-center/notification', secondary_to: '/notification-center/promo', }, { to: '/history/order', secondary_to: '/history/consultation' }, { to: '/profile' }, ] export const HomeParent: React.FC = () => { const { openAlert } = useGlobalContext() const [dataMenuName, getMenuName] = useGet({ isLoading: false, }) const [menuName, setMenuName] = useState<any>() useEffect(() => { const { data } = dataMenuName let tmp: any = [] if (data?.status === 'success') { data?.result?.main_menu?.map((item: any) => { tmp.push({ icon: item?.icon1, icon_active: item?.icon2, title: item?.text_menu, text_color: item?.text_color, isLoading: dataMenuName.isLodaing, }) }) setMenuName( tmp?.map((item: any, i: number) => Object.assign({}, item, MENU[i])) ) } else if (data?.status === 'fail') { openAlert({ messages: data?.messages }) } }, [dataMenuName]) useEffect(() => { getMenuName.getRequest(API.HOME_TEXT_LIST) }, []) return ( <> <Routes> <Route path='/home' element={<Home />} /> <Route element={<NotificationParent />}> <Route path='/notification-center/:type' /> </Route> <Route element={<History />}> <Route path='/history/:type' /> </Route> <Route path='/profile' element={<Profile />} /> </Routes> <MenuBottom menu={menuName} /> </> ) }