Fix initial channel creation bug in frontend
parent
448e25de50
commit
041ad18a6d
|
@ -45,7 +45,7 @@ export const API = {
|
||||||
async createChannel(name: string) {
|
async createChannel(name: string) {
|
||||||
const response = await API.request("POST", "channels", { name });
|
const response = await API.request("POST", "channels", { name });
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
return json.channel as IChannel;
|
return json as IChannel;
|
||||||
},
|
},
|
||||||
|
|
||||||
async deleteChannel(id: string) {
|
async deleteChannel(id: string) {
|
||||||
|
|
|
@ -162,7 +162,11 @@ export class MainView extends View {
|
||||||
if (state.defaultChannelId) {
|
if (state.defaultChannelId) {
|
||||||
this.switchChannel(state.defaultChannelId.toString());
|
this.switchChannel(state.defaultChannelId.toString());
|
||||||
} else {
|
} else {
|
||||||
this.switchChannel(state.channelList.channels[0].id.toString());
|
if (state.channelList.channels.length > 0) {
|
||||||
|
this.switchChannel(state.channelList.channels[0].id.toString());
|
||||||
|
} else {
|
||||||
|
this.createNewChannel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.save();
|
state.save();
|
||||||
|
|
Loading…
Reference in New Issue