diff --git a/README.md b/README.md
index 33895ab..9f144b3 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,16 @@
+# Environment
+
+Make sure you've set up the database before you do this. This project uses PostgreSQL with Diesel on the backend.
+
+I use [localtunnel](https://github.com/localtunnel/localtunnel) for my local development environment. You'll need to set up a Telegram bot using BotFather, and take the following steps:
+
+* Change the `bot-username` prop on the `LoginWidget` tag within `BrandBar.vue` to the username of the bot you set up with BotFather.
+* Send the command `/setdomain` to BotFather, and select the bot you set up previously.
+* Run localtunnel with `lt --port 5173`.
+* Send the domain provided by localtunnel to BotFather.
+
+After these steps have been completed, you will be able to authenticate with Telegram via stored sessions.
+
# Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `
diff --git a/src/components/BrandBar.vue b/src/components/BrandBar.vue
index 0b2345b..a755df7 100644
--- a/src/components/BrandBar.vue
+++ b/src/components/BrandBar.vue
@@ -3,7 +3,21 @@
-
+
+
+
+
+
+
@@ -13,21 +27,27 @@ import type { LoginWidgetUser } from "vue-tg";
import ColoredHeader from "./ColoredHeader.vue";
import { useFetch } from "../composables/useFetch.ts";
import { useSession } from "../composables/useSession.ts";
+import { AuthenticateRequest, AuthenticateResponse } from "../types/user.ts";
+import { computed } from "vue";
const { post } = useFetch();
-const { setSessionId } = useSession();
+const { setSessionId, setUsername, getUsername } = useSession();
const handleUserAuth = async (user: LoginWidgetUser) => {
- const sessionId = await post("/user/authenticate",
+ const response = await post("/sessions/authenticate",
{
+ user_id: user.id,
auth_date: user.auth_date,
username: user.username,
first_name: user.first_name,
last_name: user.last_name,
photo_url: user.photo_url
});
- setSessionId(sessionId.session_id);
+ setSessionId(response.session_id);
+ setUsername(user.username);
}
+
+const username = computed(() => getUsername());
\ No newline at end of file
diff --git a/src/components/Thread.vue b/src/components/Thread.vue
new file mode 100644
index 0000000..61b77fb
--- /dev/null
+++ b/src/components/Thread.vue
@@ -0,0 +1,21 @@
+
+