created frontend with login, room listing and creation, and message page with all features
This commit is contained in:
17
src/api/messages.ts
Normal file
17
src/api/messages.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { apiFetch } from './client'
|
||||
import type { Message } from '../types/api'
|
||||
|
||||
export function fetchMessages(roomUuid: string) {
|
||||
return apiFetch<Message[]>(`/messages/${roomUuid}`)
|
||||
}
|
||||
|
||||
export function sendMessage(roomUuid: string, content: string) {
|
||||
return apiFetch<Message>(`/messages/${roomUuid}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
message_type: 'text',
|
||||
content,
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user