clean: use camel case for class file
This commit is contained in:
39
frontend/static/js/api/chat/Channels.js
Normal file
39
frontend/static/js/api/chat/Channels.js
Normal file
@ -0,0 +1,39 @@
|
||||
import {Channel} from "./Channel.js";
|
||||
|
||||
class Channels {
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
this.channel = undefined;
|
||||
}
|
||||
|
||||
async createChannel(members_id, reload) {
|
||||
|
||||
let response = await this.client._post("/api/chat/", {
|
||||
members_id:members_id
|
||||
});
|
||||
|
||||
if (response.status >= 300)
|
||||
return undefined;
|
||||
|
||||
let data = await response.json();
|
||||
|
||||
let messages;
|
||||
if (response.status == 200)
|
||||
messages = data.messages;
|
||||
|
||||
this.channel = new Channel(this.client, data.channel_id, members_id, messages, reload);
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
async deleteChannel(members_id) {
|
||||
let response = await this.client._delete("/api/chat/", {
|
||||
members_id:members_id
|
||||
});
|
||||
|
||||
let data = await response.json();
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export {Channels};
|
Reference in New Issue
Block a user