fixed double socket initialisation and room settings not updating password
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
import { onMount } from 'svelte';
|
||||
import GenerateUserDisplay from '../../pieces/GenerateUserDisplay.svelte';
|
||||
import { push } from 'svelte-spa-router';
|
||||
|
||||
import Chat from '../../pieces/chat/Chat.svelte';
|
||||
import { fetchUser } from "../../pieces/utils";
|
||||
|
||||
let user;
|
||||
|
||||
@@ -75,8 +75,6 @@
|
||||
style = style_light;
|
||||
}
|
||||
|
||||
init_socket();
|
||||
|
||||
$: change_style($location);
|
||||
$: {
|
||||
$location;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
|
||||
import { layout, current_room, settings_user } from './Store_chat';
|
||||
import { get_room_users, leave_room, get_is_admin } from './Request_rooms';
|
||||
import { get_room_users, leave_room, get_is_admin, get_current_room } from './Request_rooms';
|
||||
import { User } from './Types_chat';
|
||||
import { to_print } from './Utils_chat';
|
||||
import Button from './Element_button.svelte';
|
||||
@@ -13,6 +13,9 @@
|
||||
let is_admin = false;
|
||||
get_is_admin().then(response => is_admin = response);
|
||||
|
||||
get_current_room().then(response => current_room.set(response.room));
|
||||
$: console.log("current_room infos:", $current_room);
|
||||
|
||||
to_print("current_room:", $current_room);
|
||||
|
||||
function user_profile(room_user: string)
|
||||
|
||||
@@ -66,6 +66,16 @@ export async function change_room(room: Room): Promise<FetchResponse>
|
||||
return response;
|
||||
}
|
||||
|
||||
export async function get_current_room()
|
||||
{
|
||||
to_print("in validate_password");
|
||||
|
||||
let response: FetchResponse = await fetch_chat_request('currentroom', FetchMethod.GET);
|
||||
to_print("response from get_current_room:", response);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
export async function validate_password(room: Room)
|
||||
{
|
||||
to_print("in validate_password");
|
||||
|
||||
@@ -8,6 +8,7 @@ const address = `http://${process.env.WEBSITE_HOST}:${process.env.WEBSITE_PORT}`
|
||||
export async function init_socket()
|
||||
{
|
||||
to_print("in init_socket");
|
||||
//console.error("in init_socket");
|
||||
const user = await fetchUser();
|
||||
if (!user)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user