fix
This commit is contained in:
parent
c35452a085
commit
8f2b07872c
|
|
@ -85,7 +85,7 @@ export const SyncActions = {
|
||||||
type: "join";
|
type: "join";
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
| { type: "code"; id: string; action: "open" | "close" }
|
| { type: "code"; id: string; name: string; action: "open" | "close" }
|
||||||
) => {},
|
) => {},
|
||||||
client: {
|
client: {
|
||||||
info: async (client_ids: string[]) =>
|
info: async (client_ids: string[]) =>
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,18 @@ import { activity as a } from "../entity/activity";
|
||||||
export const activity: SAction["activity"] = async function (
|
export const activity: SAction["activity"] = async function (
|
||||||
this: SyncConnection,
|
this: SyncConnection,
|
||||||
name,
|
name,
|
||||||
type,
|
act
|
||||||
id
|
|
||||||
) {
|
) {
|
||||||
if (type === "join") a.site.room(id).join({ ws: this.ws });
|
const me = { ws: this.ws };
|
||||||
if (type === "leave") a.site.room(id).leave({ ws: this.ws });
|
if (act.type === "join") a.site.room(act.id).join(me);
|
||||||
|
if (act.type === "code") {
|
||||||
|
a.site.room(act.id).set(me, (ws, data) => {
|
||||||
|
if (act.action === "open") {
|
||||||
|
data.code = { name: act.name };
|
||||||
|
} else {
|
||||||
|
delete data.code;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ export const EdPopCode = () => {
|
||||||
action: p.ui.popup.code.open ? "open" : "close",
|
action: p.ui.popup.code.open ? "open" : "close",
|
||||||
id: p.site.id,
|
id: p.site.id,
|
||||||
type: "code",
|
type: "code",
|
||||||
|
name: "main",
|
||||||
});
|
});
|
||||||
}, [p.ui.popup.code.open]);
|
}, [p.ui.popup.code.open]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue