tr(v-for="c in challenges" @click="$emit('click-challenge',c)")
td {{ c.vname }}
td {{ c.from.name }}
- td(v-if="!!c.to[0]")
- span(v-for="pname in c.to") {{ pname }}
- td(v-else) {{ c.to.length }} player{{ c.to.length >= 2 ? 's' : '' }}
+ td {{ c.to }}
td {{ c.timeControl }}
</template>
{target: sid}
)));
};
- if (!!to[0])
+ if (!!to)
{
- to.forEach(pname => {
- // Challenge with targeted players
- const targetSid = this.getSid(pname);
- if (!targetSid)
- {
- if (!!warnDisconnected)
- alert("Warning: " + pname + " is not connected");
- }
- else
- doSend(code, obj, targetSid);
- });
+ // Challenge with targeted players
+ const targetSid = this.getSid(to);
+ if (!targetSid)
+ {
+ if (!!warnDisconnected)
+ alert("Warning: " + pname + " is not connected");
+ }
+ else
+ doSend(code, obj, targetSid);
}
else
{
const finishAddChallenge = (cid,warnDisconnected) => {
chall.id = cid || "c" + getRandString();
// Send challenge to peers (if connected)
- this.sendSomethingTo(cto, "challenge", {chall:chall}, !!warnDisconnected);
+ this.sendSomethingTo(chall.to, "challenge", {chall:chall}, !!warnDisconnected);
chall.added = Date.now();
chall.type = ctype;
chall.vname = vname;