refactor: Splitting API requests from app.js (#1175)

This commit is contained in:
pa
2025-03-07 21:45:59 +09:00
committed by GitHub
parent 5c378cc64c
commit 010535996d
16 changed files with 1345 additions and 1218 deletions

View File

@@ -0,0 +1,56 @@
// #region | API: PlayerModeration
const playerModerationReq = {
getPlayerModerations() {
return window.API.call('auth/user/playermoderations', {
method: 'GET'
}).then((json) => {
const args = {
json
};
window.API.$emit('PLAYER-MODERATION:LIST', args);
return args;
});
},
/**
* @param {{ moderated: string, type: string }} params
* @return { Promise<{json: any, params}> }
*/
// old-way: POST auth/user/blocks {blocked:userId}
sendPlayerModeration(params) {
return window.API.call('auth/user/playermoderations', {
method: 'POST',
params
}).then((json) => {
const args = {
json,
params
};
window.API.$emit('PLAYER-MODERATION:SEND', args);
return args;
});
},
/**
* @param {{ moderated: string, type: string }} params
* @return { Promise<{json: any, params}> }
*/
// old-way: PUT auth/user/unblocks {blocked:userId}
deletePlayerModeration(params) {
return window.API.call('auth/user/unplayermoderate', {
method: 'PUT',
params
}).then((json) => {
const args = {
json,
params
};
window.API.$emit('PLAYER-MODERATION:DELETE', args);
return args;
});
}
};
// #endregion
export default playerModerationReq;