diff options
| author | Dhravya <[email protected]> | 2024-06-23 20:04:09 -0500 |
|---|---|---|
| committer | Dhravya <[email protected]> | 2024-06-23 20:04:09 -0500 |
| commit | 51dd5ec9dd35d87c2e93a8e5a64fa963caaa182a (patch) | |
| tree | bbd6a2d0d1029c5aedcd2a7121987083649598d7 /apps/web/app/(dash) | |
| parent | added backend route for telegram bot and others to be possible (diff) | |
| download | supermemory-51dd5ec9dd35d87c2e93a8e5a64fa963caaa182a.tar.xz supermemory-51dd5ec9dd35d87c2e93a8e5a64fa963caaa182a.zip | |
made and documented the telegram bot (HYPE)
Diffstat (limited to 'apps/web/app/(dash)')
| -rw-r--r-- | apps/web/app/(dash)/home/page.tsx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/apps/web/app/(dash)/home/page.tsx b/apps/web/app/(dash)/home/page.tsx index b6cfd223..a4235f1b 100644 --- a/apps/web/app/(dash)/home/page.tsx +++ b/apps/web/app/(dash)/home/page.tsx @@ -5,7 +5,8 @@ import QueryInput from "./queryinput"; import { homeSearchParamsCache } from "@/lib/searchParams"; import { getSpaces } from "@/app/actions/fetchers"; import { useRouter } from "next/navigation"; -import { createChatThread } from "@/app/actions/doers"; +import { createChatThread, linkTelegramToUser } from "@/app/actions/doers"; +import { toast } from "sonner"; function Page({ searchParams, @@ -14,11 +15,30 @@ function Page({ }) { // TODO: use this to show a welcome page/modal // const { firstTime } = homeSearchParamsCache.parse(searchParams); + + const [telegramUser, setTelegramUser] = useState<string | undefined>( + searchParams.telegramUser as string, + ); + const { push } = useRouter(); const [spaces, setSpaces] = useState<{ id: number; name: string }[]>([]); useEffect(() => { + if (telegramUser) { + const linkTelegram = async () => { + const response = await linkTelegramToUser(telegramUser); + + if (response.success) { + toast.success("Your telegram has been linked successfully."); + } else { + toast.error("Failed to link telegram. Please try again."); + } + }; + + linkTelegram(); + } + getSpaces().then((res) => { if (res.success && res.data) { setSpaces(res.data); |