Fix initial channel creation bug in frontend

main
Talon 2024-08-23 22:32:58 +02:00
parent 448e25de50
commit 041ad18a6d
2 changed files with 6 additions and 2 deletions

View File

@ -45,7 +45,7 @@ export const API = {
async createChannel(name: string) {
const response = await API.request("POST", "channels", { name });
const json = await response.json();
return json.channel as IChannel;
return json as IChannel;
},
async deleteChannel(id: string) {

View File

@ -162,7 +162,11 @@ export class MainView extends View {
if (state.defaultChannelId) {
this.switchChannel(state.defaultChannelId.toString());
} else {
if (state.channelList.channels.length > 0) {
this.switchChannel(state.channelList.channels[0].id.toString());
} else {
this.createNewChannel();
}
}
}
state.save();