-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix docker compose and added message on approve new ambassador
- Loading branch information
1 parent
54c93a5
commit 26b197d
Showing
4 changed files
with
35 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,52 @@ | ||
import { useEffect, useState } from 'react' | ||
import './App.css' | ||
import { useTelegram } from './hooks/useTelegram' | ||
import ColorTabs from './components/Tabs/Tabs' | ||
import Profile from './pages/Profile' | ||
import Achievements from './pages/Achievements' | ||
import { useEffect, useState } from "react"; | ||
import "./App.css"; | ||
import { useTelegram } from "./hooks/useTelegram"; | ||
import ColorTabs from "./components/Tabs/Tabs"; | ||
import Profile from "./pages/Profile"; | ||
import Achievements from "./pages/Achievements"; | ||
|
||
export default function App() { | ||
const {webApp, user} = useTelegram() | ||
const [currentTab, setCurrentTab] = useState('profile') | ||
const [ambassador, setAmbassador] = useState() | ||
const { webApp, user } = useTelegram(); | ||
const [currentTab, setCurrentTab] = useState("profile"); | ||
const [ambassador, setAmbassador] = useState(); | ||
|
||
useEffect(() => { | ||
webApp.ready() | ||
}, []) | ||
webApp.ready(); | ||
}, []); | ||
|
||
useEffect(() => { | ||
if (user) { | ||
const fetchData = async () => { | ||
try { | ||
const response = await fetch('/api/v1/ambassador_by_tg_username/' + user.username) | ||
const jsonData = await response.json() | ||
setAmbassador(jsonData) | ||
const response = await fetch( | ||
"/api/v1/ambassador_by_tg_username/" + user.username | ||
); | ||
const jsonData = await response.json(); | ||
setAmbassador(jsonData); | ||
} catch (error) { | ||
console.error('Ошибка при получении данных:', error) | ||
console.error("Ошибка при получении данных:", error); | ||
} | ||
} | ||
fetchData() | ||
}; | ||
fetchData(); | ||
} | ||
}, []) | ||
}, []); | ||
|
||
function onChangeTab (value) { | ||
setCurrentTab(value) | ||
function onChangeTab(value) { | ||
setCurrentTab(value); | ||
} | ||
|
||
return ( | ||
<> | ||
{user && <> | ||
<ColorTabs onClick={onChangeTab} currentTab={currentTab}/> | ||
{/* <Header /> */} | ||
{currentTab === "profile" && <Profile data={ambassador}/>} | ||
{currentTab === "achievements" && <Achievements />} | ||
{/* {currentTab === "statistic" && <Statistic />} */} | ||
{/* <button onClick={onToogleButton}>toogle</button> */} | ||
</>} | ||
{user && ( | ||
<> | ||
<ColorTabs onClick={onChangeTab} currentTab={currentTab} /> | ||
{/* <Header /> */} | ||
{currentTab === "profile" && <Profile data={ambassador} />} | ||
{currentTab === "achievements" && <Achievements />} | ||
{/* {currentTab === "statistic" && <Statistic />} */} | ||
{/* <button onClick={onToogleButton}>toogle</button> */} | ||
</> | ||
)} | ||
</> | ||
); | ||
} |