JoinGroup: redirect if we have the group

Joining a group we have fails. We now redirect to the workspace.

Fixes urbit/landscape#683
This commit is contained in:
Matilde Park 2021-04-13 14:12:10 -04:00
parent 1ae61a0715
commit 3245465281

View File

@ -81,6 +81,9 @@ export function JoinGroup(props: JoinGroupProps): ReactElement {
if(group === TUTORIAL_GROUP_RESOURCE) {
await api.settings.putEntry('tutorial', 'joined', Date.now());
}
if (group in groups) {
return history.push(`/~landscape${group}`);
}
await api.groups.join(ship, name);
try {
await waiter((p) => {
@ -111,6 +114,9 @@ export function JoinGroup(props: JoinGroupProps): ReactElement {
async (values: FormSchema, actions: FormikHelpers<FormSchema>) => {
const [ship, name] = values.group.split('/');
const path = `/ship/${ship}/${name}`;
if (path in groups) {
return history.push(`/~landscape${path}`);
}
// skip if it's unmanaged
try {
const prev = await api.metadata.preview(path);