render channel list dynamically based on channel activity

This commit is contained in:
Riku Rouvila
2020-09-23 21:21:30 +03:00
parent b84c162c65
commit ab869aaaa6
5 changed files with 492 additions and 94 deletions

22
data/channels.ts Normal file
View File

@@ -0,0 +1,22 @@
import axios from "axios";
export interface Channel {
id: string;
name: string;
topic: string;
num_members: number;
purpose: {
value: string;
creator: string;
last_set: number;
};
messages_today: number;
unique_members_today: number;
}
export async function getChannels() {
const response = await axios.get<Channel[]>(
"http://stats.koodiklinikka.fi/api/channels"
);
return response.data;
}