update, allow disconnecting
This commit is contained in:
+12
-1
@@ -49,6 +49,11 @@ export const connectionMessage = React.createProxyState([serverAddress], () =>
|
||||
translation.connectedTo(serverAddress.value)
|
||||
);
|
||||
|
||||
export const cannotDisonnect = React.createProxyState(
|
||||
[isConnected],
|
||||
() => isConnected.value == false
|
||||
);
|
||||
|
||||
export const cannotConnect = React.createProxyState(
|
||||
[serverAddress, currentAddress, isConnected],
|
||||
() =>
|
||||
@@ -88,8 +93,9 @@ export const cannotAddSecondaryChannel = React.createProxyState(
|
||||
);
|
||||
|
||||
export const cannotSendMessage = React.createProxyState(
|
||||
[currentPrimaryChannel, messageBody, senderName],
|
||||
[currentPrimaryChannel, messageBody, senderName, isConnected],
|
||||
() =>
|
||||
isConnected.value == false ||
|
||||
currentPrimaryChannel.value == "" ||
|
||||
messageBody.value == "" ||
|
||||
senderName.value == ""
|
||||
@@ -106,6 +112,11 @@ export function connect() {
|
||||
UDN.connect(serverAddress.value);
|
||||
}
|
||||
|
||||
export function disconnect() {
|
||||
if (cannotDisonnect.value == true) return;
|
||||
UDN.disconnect();
|
||||
}
|
||||
|
||||
export async function sendMessage(): Promise<void> {
|
||||
if (cannotSendMessage.value == true) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user