add roomid to identitystore

This commit is contained in:
2023-07-08 23:39:02 -04:00
parent b1ffe5466a
commit 4743e8a913

View File

@@ -15,9 +15,10 @@
function addCode(code: string) {
const url = String('http://' + $serverDataStore[$selectedServer].serverInfoEndpoint + '/join');
const idc = $identityStore.identity._commitment;
const data = JSON.stringify({
code: code,
idc: $identityStore.identity.getCommitment().toString()
idc: idc
});
console.log(data);
fetch(url, {
@@ -31,6 +32,13 @@
.then(async (response) => {
const result = await response.json();
console.log('INVITE CODE RESPONSE: ', result);
if (result.groupID) {
$identityStore.rooms[result.groupID] = idc;
accepted = true;
} else {
code = '';
alert('Invalid invite code');
}
})
.catch((err) => {
console.error(err);
@@ -49,7 +57,6 @@
if (event.key === 'Enter') {
event.preventDefault();
addCode(code);
code = '';
} else if (event.key === ' ' || event.key === '-') {
event.preventDefault();
if (code.length > 0 && code[code.length - 1] !== '-') {