handle invite code errors better

This commit is contained in:
2023-10-23 18:31:33 -04:00
parent edb649bb71
commit 97a61d83d5
2 changed files with 4 additions and 1 deletions

View File

@@ -16,6 +16,7 @@
if (err) {
alertQueue.enqueue(err, 'error');
} else {
alertQueue.enqueue(`Accepted into ${acceptedRoomNames}`, 'success');
acceptedRoomNames = acceptedRoomNames;
}
})

View File

@@ -19,7 +19,7 @@ export async function inviteCode(newCode: string) {
idc
})) as JoinResponseI;
console.debug('INVITE CODE RESPONSE: ', result);
if (result.status == 'valid' || result.status == 'already-added') {
if (result.status == 'valid') {
console.debug('Updating new rooms');
acceptedRoomNames = await updateRooms(server, result.roomIds);
console.log(`Added to rooms: ${acceptedRoomNames}`);
@@ -29,6 +29,8 @@ export async function inviteCode(newCode: string) {
return store;
});
return { acceptedRoomNames, undefined };
} else if (result.status == 'already-added') {
return { acceptedRoomNames, err: 'You are already a member of this room.' };
} else {
err = 'Invalid invite code.';
}