In progress
This commit is contained in:
@ -23,7 +23,7 @@ export default class Notice {
|
||||
this._socket.onclose = _ => this._socket = undefined;
|
||||
this._socket.onmessage = message => {
|
||||
const data = JSON.parse(message.data);
|
||||
//console.log(data)
|
||||
console.log(data)
|
||||
|
||||
if (data.type === 'friend_request') {
|
||||
this.friend_request(data.author);
|
||||
@ -37,7 +37,15 @@ export default class Notice {
|
||||
this.online(data.user)
|
||||
} else if (data.type === 'offline') {
|
||||
this.offline(data.user)
|
||||
}
|
||||
} else if (data.type == 'game_asked') {
|
||||
|
||||
} else if (data.type == 'game_canceled') {
|
||||
|
||||
} else if (data.type == 'game_accepted') {
|
||||
|
||||
} else if (data.type == 'game_refused') {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -5,18 +5,24 @@ class Ask {
|
||||
}
|
||||
|
||||
async ask_game(asked) {
|
||||
response = await this.client._post(`/api/chat/ask/`);
|
||||
response = await this.client._post(`/api/chat/ask/`, {
|
||||
asked:asked,
|
||||
});
|
||||
}
|
||||
|
||||
async ask_game_canceled() {
|
||||
|
||||
}
|
||||
|
||||
async ask_game_accepted() {
|
||||
|
||||
async ask_game_accepted(asker) {
|
||||
response = await this.client._post(`/api/chat/ask/accept`, {
|
||||
asker:asker,
|
||||
});
|
||||
}
|
||||
|
||||
async ask_game_refused() {
|
||||
|
||||
async ask_game_refused(asker) {
|
||||
response = await this.client._delete(`/api/chat/ask/`, {
|
||||
asker:asker,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user