.
This commit is contained in:
@@ -1,12 +1,5 @@
|
||||
import axios from "../http-client";
|
||||
import type {
|
||||
ChannelId,
|
||||
ChannelType,
|
||||
Server,
|
||||
ServerChannel,
|
||||
ServerId,
|
||||
ServerInvite,
|
||||
} from "../types";
|
||||
import type { ChannelId, ChannelType, Server, ServerChannel, ServerId, ServerInvite } from "../types";
|
||||
|
||||
interface CreateServerRequest {
|
||||
name: string;
|
||||
@@ -48,27 +41,20 @@ export async function listChannels(serverId: ServerId) {
|
||||
return response.data as ServerChannel[];
|
||||
}
|
||||
|
||||
export async function createChannel(
|
||||
serverId: ServerId,
|
||||
request: CreateServerChannelRequest,
|
||||
) {
|
||||
export async function createChannel(serverId: ServerId, request: CreateServerChannelRequest) {
|
||||
const response = await axios.post(`/servers/${serverId}/channels`, request);
|
||||
|
||||
return response.data as ServerChannel;
|
||||
}
|
||||
|
||||
export async function getChannel(serverId: ServerId, channelId: ChannelId) {
|
||||
const response = await axios.get(
|
||||
`/servers/${serverId}/channels/${channelId}`,
|
||||
);
|
||||
const response = await axios.get(`/servers/${serverId}/channels/${channelId}`);
|
||||
|
||||
return response.data as ServerChannel;
|
||||
}
|
||||
|
||||
export async function deleteChannel(serverId: ServerId, channelId: ChannelId) {
|
||||
const response = await axios.delete(
|
||||
`/servers/${serverId}/channels/${channelId}`,
|
||||
);
|
||||
const response = await axios.delete(`/servers/${serverId}/channels/${channelId}`);
|
||||
|
||||
return response.data as ServerChannel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user