Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Added user registration call

Gabe Kangas05bb6b8d5c86
diff --git a/web/services/UserService.ts b/web/services/UserService.ts
new file mode 100644
index 0000000000..66bc7bdc1b
--- /dev/null
+++ b/web/services/UserService.ts
@@ -0,0 +1,29 @@
+const URL_CHAT_REGISTRATION = `http://localhost:8080/api/chat/register`;
+
+interface UserRegistrationResponse {
+ id: string;
+ accessToken: string;
+ displayName: string;
+}
+
+class UserService {
+ registerUser(username: string): Promise<UserRegistrationResponse> {
+ const options = {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ displayName: username }),
+ };
+
+ try {
+ const response = await fetch(URL_CHAT_REGISTRATION, options);
+ const result = await response.json();
+ return result;
+ } catch (e) {
+ console.error(e);
+ }
+
+ return null;
+ }
+}
\ No newline at end of file