feat: block access for pin protected rooms
This commit is contained in:
parent
7587796934
commit
1063c239b6
3 changed files with 5 additions and 4 deletions
|
@ -1,8 +1,8 @@
|
|||
import { get_coords, type Coordinates } from "./gps"
|
||||
import { type Coordinates } from "./gps"
|
||||
import { parseSong, parseSuggestion, type FetchError, type Song, type Suggestion } from "./types"
|
||||
|
||||
export const joinRoom = async function (roomId: string, coords: Coordinates): Promise<[FetchError | null, string]> {
|
||||
let res = await fetch(`/api/join?room=${roomId}&lat=${coords.latitude}&lon=${coords.longitude}`)
|
||||
export const joinRoom = async function (roomId: string, coords: Coordinates, pin: string): Promise<[FetchError | null, string]> {
|
||||
let res = await fetch(`/api/join?room=${roomId}&lat=${coords.latitude}&lon=${coords.longitude}&pin=${pin}`)
|
||||
|
||||
if (res.status != 200) {
|
||||
return [{ code: 400, message: "Cannot join the room" }, ""]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue