Skip to content

Commit

Permalink
feat: INVITE_BROWSER handling
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Nov 9, 2024
1 parent 2cd6522 commit 48bfaa1
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion plugins/shelteRPC/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,43 @@ async function handleMessage(e: MessageEvent<string>) {
const handleCmd = async (payload: any) => {
switch(payload.cmd) {
case 'INVITE_BROWSER':
// TODO
const code = payload.args.code

Check failure on line 125 in plugins/shelteRPC/index.tsx

View workflow job for this annotation

GitHub Actions / tsc-eslint-checks

Unexpected lexical declaration in case block

if (code === '') {
// This should never happen
return
}

// This is mostly to better replicate client behaviour
FluxDispatcher.dispatch({
type: 'INVITE_RESOLVE',
code
})

const resp = await http.get(`/invites/${code}`)

Check failure on line 138 in plugins/shelteRPC/index.tsx

View workflow job for this annotation

GitHub Actions / tsc-eslint-checks

Unexpected lexical declaration in case block
const invite = resp.body

Check failure on line 139 in plugins/shelteRPC/index.tsx

View workflow job for this annotation

GitHub Actions / tsc-eslint-checks

Unexpected lexical declaration in case block

if (resp.status !== 200) {
FluxDispatcher.dispatch({
type: 'INVITE_RESOLVE_FAILED',
code,
...resp.body,
})
return
}

FluxDispatcher.dispatch({
type: 'INVITE_RESOLVE_SUCCESS',
code,
invite,
})

FluxDispatcher.dispatch({
type: 'INVITE_MODAL_OPEN',
context: 'APP',
code,
invite,
})
}
}

Expand Down

0 comments on commit 48bfaa1

Please sign in to comment.