diff --git a/api/src/rpc.ts b/api/src/rpc.ts index b1bb7c1..b3414f2 100644 --- a/api/src/rpc.ts +++ b/api/src/rpc.ts @@ -109,7 +109,18 @@ export default function createRpc(log: Log, pg: Pg, user: User, ws, discogs, off throw new Error(`Invalid parameters for message type ${msgType}: ${JSON.stringify(message)}`); } + async function anonConnection() { + + } + + async function adminConnection() { + // don't need it, requested on route + // send(await acpOffers()); + } + async function onConnection() { + if (!user) return anonConnection(); + const userMsg: UserMessage = [RpcMessageType.User, user]; send(userMsg); @@ -120,6 +131,8 @@ export default function createRpc(log: Log, pg: Pg, user: User, ws, discogs, off const wants = await pg.userWants(user); const wantsMsg: WantsMessage = [RpcMessageType.Wants, wants]; send(wantsMsg); + + if (isAdmin(user)) return adminConnection(); } function send(msg: RpcMessage) {