Extract API endpoints for user avatars

This commit is contained in:
Cohee
2024-03-20 00:39:48 +02:00
parent 41528d0423
commit d448d4f65b
4 changed files with 76 additions and 58 deletions

View File

@ -5552,7 +5552,7 @@ function changeMainAPI() {
* @returns {Promise<string[]>} List of avatar file names
*/
export async function getUserAvatars(doRender = true, openPageAt = '') {
const response = await fetch('/getuseravatars', {
const response = await fetch('/api/avatars/get', {
method: 'POST',
headers: getRequestHeaders(),
});
@ -5699,7 +5699,7 @@ async function uploadUserAvatar(e) {
const formData = new FormData($('#form_upload_avatar').get(0));
const dataUrl = await getBase64Async(file);
let url = '/uploaduseravatar';
let url = '/api/avatars/upload';
if (!power_user.never_resize_avatars) {
$('#dialogue_popup').addClass('large_dialogue_popup wide_dialogue_popup');