Add user detail API + modal. Closes #2002

This commit is contained in:
Gabe Kangas
2022-07-20 20:42:23 -07:00
parent 82a0b492a5
commit f3a16be0dd
21 changed files with 543 additions and 60 deletions

View File

@@ -1,5 +1,6 @@
import { ChatMessage } from '../interfaces/chat-message.model';
import { getUnauthedData } from '../utils/apis';
const ENDPOINT = `/api/chat`;
const URL_CHAT_REGISTRATION = `/api/chat/register`;

View File

@@ -0,0 +1,38 @@
const HIDE_MESSAGE_ENDPOINT = `/api/chat/messagevisibility`;
const BAN_USER_ENDPOINT = `/api/chat/users/setenabled`;
class ChatModerationService {
public static async removeMessage(id: string, accessToken: string): Promise<any> {
const url = new URL(HIDE_MESSAGE_ENDPOINT, window.location.toString());
url.searchParams.append('accessToken', accessToken);
const hideMessageUrl = url.toString();
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ idArray: [id] }),
};
await fetch(hideMessageUrl, options);
}
public static async banUser(id: string, accessToken: string): Promise<any> {
const url = new URL(BAN_USER_ENDPOINT, window.location.toString());
url.searchParams.append('accessToken', accessToken);
const hideMessageUrl = url.toString();
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ id }),
};
await fetch(hideMessageUrl, options);
}
}
export default ChatModerationService;