Begin implementing the socket event handlers
This commit is contained in:
parent
36811b268c
commit
bfd408ef0b
3 changed files with 72 additions and 8 deletions
|
|
@ -1 +1,22 @@
|
|||
export function submitRequest() {};
|
||||
import { QueryManager } from "../utils/QueryManager.mjs";
|
||||
|
||||
export function submitRequest(payload, user) {
|
||||
const {
|
||||
id,
|
||||
answers,
|
||||
} = payload;
|
||||
|
||||
if (!id) {
|
||||
ui.notifications.error(game.i18n.format(
|
||||
`taf.notifs.error.malformed-socket-payload`,
|
||||
{
|
||||
event: `query.submit`,
|
||||
details: `A request ID must be provided`,
|
||||
}),
|
||||
);
|
||||
return;
|
||||
};
|
||||
|
||||
if (!QueryManager.has(id)) { return };
|
||||
QueryManager.addResponse(id, user.id, answers);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue