etienne apprend à coder pitié
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import {Channel} from "./Channel.js";
|
||||
|
||||
class Channels {
|
||||
export default class Channels {
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
this.channel = undefined;
|
||||
@ -8,32 +8,16 @@ class Channels {
|
||||
|
||||
async createChannel(members_id, reload) {
|
||||
|
||||
let response = await this.client._post("/api/chat/", {
|
||||
const response = await this.client._post("/api/chat/", {
|
||||
members_id:members_id
|
||||
});
|
||||
|
||||
if (response.status >= 300)
|
||||
return undefined;
|
||||
|
||||
let data = await response.json();
|
||||
const data = await response.json();
|
||||
console.log(data)
|
||||
|
||||
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;
|
||||
this.channel = new Channel(this.client, data.id, members_id, data.messages, reload);
|
||||
}
|
||||
|
||||
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