This commit is contained in:
2025-05-15 05:20:01 +03:00
parent 623521f3b4
commit 21a05dd202
70 changed files with 4663 additions and 161 deletions

View File

@@ -0,0 +1,34 @@
import axios from "../http-client"
import type { User } from "../types"
interface RegisterRequest {
email: string
username: string
displayName?: string
password: string
}
interface LoginRequest {
username: string
password: string
}
interface LoginResponse {
user: User
token: string
}
export async function register(request: RegisterRequest) {
await axios.post("/auth/register", request)
}
export async function login(request: LoginRequest) {
const response = await axios.post("/auth/login", request)
return response.data as LoginResponse
}
export default {
register,
login,
}

View File

@@ -0,0 +1,24 @@
import axios from "../http-client"
import type { Server } from "../types"
interface CreateServerRequest {
name: string
icon?: File
}
export async function create(request: CreateServerRequest) {
const response = await axios.postForm("/servers", request)
return response.data as Server
}
export async function list() {
const response = await axios.get("/servers")
return response.data as Server[]
}
export default {
create,
list,
}

View File

@@ -0,0 +1,14 @@
import axios from "../http-client"
import type { Uuid } from "../types"
export async function test(channel_id: Uuid, sdp: RTCSessionDescriptionInit) {
const response = await axios.post(`/voice/${channel_id}/connect`, {
sdp: sdp
})
return response.data.sdp as RTCSessionDescriptionInit
}
export default {
test
}

View File

@@ -0,0 +1,19 @@
import axios from "../http-client"
import type { RecipientChannel, User } from "../types"
export async function me() {
const response = await axios.get("/users/@me")
return response.data as User
}
export async function channels() {
const response = await axios.get("/users/@me/channels")
return response.data as RecipientChannel[]
}
export default {
me,
channels
}