Skip to content

Commit

Permalink
chore: Refactor WebSocket message handling in main.ts and remove unne…
Browse files Browse the repository at this point in the history
…cessary code
  • Loading branch information
tako0614 committed Jun 16, 2024
1 parent 697f1ed commit 7b42d0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion routes/api/v1/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export const handler = {
const { socket, response } = Deno.upgradeWebSocket(req)
socket.onmessage = async function (event) {
const data = JSON.parse(event.data)
switch (data.type) {
const { type } = data
if(!type) return
switch (type) {
case "joinRoom":
joinRoom(data.sessionid, data.roomid, socket)
break
Expand Down
3 changes: 2 additions & 1 deletion routes/api/v1/setting/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getCookies } from "$std/http/cookie.ts"
import csrftoken from "../../../../models/csrftoken.ts"
import Users from "../../../../models/users.ts"
/*
export const handler = {
async POST(req: Request, ctx: any) {
try {
Expand Down Expand Up @@ -77,7 +78,7 @@ export const handler = {
})
}
await Deno.writeFile(`./files/userIcons/${userid}.webp`, result)
*/
}
return new Response(JSON.stringify({ status: true }), {
Expand Down

0 comments on commit 7b42d0d

Please sign in to comment.