mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 22:33:50 +02:00
refactor: app.js (#1291)
* refactor: frontend * Fix avatar gallery sort * Update .NET dependencies * Update npm dependencies electron v37.1.0 * bulkRefreshFriends * fix dark theme * Remove crowdin * Fix config.json dialog not updating * VRCX log file fixes & add Cef log * Remove SharedVariable, fix startup * Revert init theme change * Logging date not working? Fix WinformThemer designer error * Add Cef request hander, no more escaping main page * clean * fix * fix * clean * uh * Apply thememode at startup, fixes random user colours * Split database into files * Instance info remove empty lines * Open external VRC links with VRCX * Electron fixes * fix userdialog style * ohhhh * fix store * fix store * fix: load all group members after kicking a user * fix: world dialog favorite button style * fix: Clear VRCX Cache Timer input value * clean * Fix VR overlay * Fix VR overlay 2 * Fix Discord discord rich presence for RPC worlds * Clean up age verified user tags * Fix playerList being occupied after program reload * no `this` * Fix login stuck loading * writable: false * Hide dialogs on logout * add flush sync option * rm LOGIN event * rm LOGOUT event * remove duplicate event listeners * remove duplicate event listeners * clean * remove duplicate event listeners * clean * fix theme style * fix t * clearable * clean * fix ipcEvent * Small changes * Popcorn Palace support * Remove checkActiveFriends * Clean up * Fix dragEnterCef * Block API requests when not logged in * Clear state on login & logout * Fix worldDialog instances not updating * use <script setup> * Fix avatar change event, CheckGameRunning at startup * Fix image dragging * fix * Remove PWI * fix updateLoop * add webpack-dev-server to dev environment * rm unnecessary chunks * use <script setup> * webpack-dev-server changes * use <script setup> * use <script setup> * Fix UGC text size * Split login event * t * use <script setup> * fix * Update .gitignore and enable checkJs in jsconfig * fix i18n t * use <script setup> * use <script setup> * clean * global types * fix * use checkJs for debugging * Add watchState for login watchers * fix .vue template * type fixes * rm Vue.filter * Cef v138.0.170, VC++ 2022 * Settings fixes * Remove 'USER:CURRENT' * clean up 2FA callbacks * remove userApply * rm i18n import * notification handling to use notification store methods * refactor favorite handling to use favorite store methods and clean up event emissions * refactor moderation handling to use dedicated functions for player moderation events * refactor friend handling to use dedicated functions for friend events * Fix program startup, move lang init * Fix friend state * Fix status change error * Fix user notes diff * fix * rm group event * rm auth event * rm avatar event * clean * clean * getUser * getFriends * getFavoriteWorlds, getFavoriteAvatars * AvatarGalleryUpload btn style & package.json update * Fix friend requests * Apply user * Apply world * Fix note diff * Fix VR overlay * Fixes * Update build scripts * Apply avatar * Apply instance * Apply group * update hidden VRC+ badge * Fix sameInstance "private" * fix 502/504 API errors * fix 502/504 API errors * clean * Fix friend in same instance on orange showing twice in friends list * Add back in broken friend state repair methods * add types --------- Co-authored-by: Natsumi <cmcooper123@hotmail.com>
This commit is contained in:
262
src/api/group.js
262
src/api/group.js
@@ -1,3 +1,9 @@
|
||||
import { request } from '../service/request';
|
||||
import { useUserStore, useGroupStore } from '../stores';
|
||||
|
||||
function getCurrentUserId() {
|
||||
return useUserStore().currentUser.id;
|
||||
}
|
||||
const groupReq = {
|
||||
/**
|
||||
* @param {string} groupId
|
||||
@@ -5,7 +11,7 @@ const groupReq = {
|
||||
* @returns
|
||||
*/
|
||||
setGroupRepresentation(groupId, params) {
|
||||
return window.API.call(`groups/${groupId}/representation`, {
|
||||
return request(`groups/${groupId}/representation`, {
|
||||
method: 'PUT',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -23,7 +29,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
cancelGroupRequest(params) {
|
||||
return window.API.call(`groups/${params.groupId}/requests`, {
|
||||
return request(`groups/${params.groupId}/requests`, {
|
||||
method: 'DELETE'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
@@ -39,12 +45,9 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
deleteGroupPost(params) {
|
||||
return window.API.call(
|
||||
`groups/${params.groupId}/posts/${params.postId}`,
|
||||
{
|
||||
method: 'DELETE'
|
||||
}
|
||||
).then((json) => {
|
||||
return request(`groups/${params.groupId}/posts/${params.postId}`, {
|
||||
method: 'DELETE'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
@@ -53,10 +56,10 @@ const groupReq = {
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @param {{ groupId: string }} params
|
||||
* @type {import('../types/group').getGroup}
|
||||
*/
|
||||
getGroup(params) {
|
||||
return window.API.call(`groups/${params.groupId}`, {
|
||||
return request(`groups/${params.groupId}`, {
|
||||
method: 'GET',
|
||||
params: {
|
||||
includeRoles: params.includeRoles || false
|
||||
@@ -66,23 +69,48 @@ const groupReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
window.API.$emit('GROUP', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {{ groupId: string }} params
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getCachedGroup(params) {
|
||||
const groupStore = useGroupStore();
|
||||
return new Promise((resolve, reject) => {
|
||||
const ref = groupStore.cachedGroups.get(params.groupId);
|
||||
if (typeof ref === 'undefined') {
|
||||
groupReq
|
||||
.getGroup(params)
|
||||
.catch(reject)
|
||||
.then((args) => {
|
||||
args.ref = groupStore.applyGroup(args.json);
|
||||
resolve(args);
|
||||
});
|
||||
} else {
|
||||
resolve({
|
||||
cache: true,
|
||||
json: ref,
|
||||
params,
|
||||
ref
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @param {{ userId: string }} params
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getRepresentedGroup(params) {
|
||||
return window.API.call(`users/${params.userId}/groups/represented`, {
|
||||
return request(`users/${params.userId}/groups/represented`, {
|
||||
method: 'GET'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
window.API.$emit('GROUP:REPRESENTED', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -91,14 +119,13 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroups(params) {
|
||||
return window.API.call(`users/${params.userId}/groups`, {
|
||||
return request(`users/${params.userId}/groups`, {
|
||||
method: 'GET'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
window.API.$emit('GROUP:LIST', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -107,14 +134,13 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
joinGroup(params) {
|
||||
return window.API.call(`groups/${params.groupId}/join`, {
|
||||
return request(`groups/${params.groupId}/join`, {
|
||||
method: 'POST'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
window.API.$emit('GROUP:JOIN', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -123,7 +149,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
leaveGroup(params) {
|
||||
return window.API.call(`groups/${params.groupId}/leave`, {
|
||||
return request(`groups/${params.groupId}/leave`, {
|
||||
method: 'POST'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
@@ -138,7 +164,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
groupStrictsearch(params) {
|
||||
return window.API.call(`groups/strictsearch`, {
|
||||
return request(`groups/strictsearch`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -159,7 +185,7 @@ const groupReq = {
|
||||
}
|
||||
*/
|
||||
setGroupMemberProps(userId, groupId, params) {
|
||||
return window.API.call(`groups/${groupId}/members/${userId}`, {
|
||||
return request(`groups/${groupId}/members/${userId}`, {
|
||||
method: 'PUT',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -169,7 +195,6 @@ const groupReq = {
|
||||
groupId,
|
||||
params
|
||||
};
|
||||
window.API.$emit('GROUP:MEMBER:PROPS', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -182,7 +207,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
addGroupMemberRole(params) {
|
||||
return window.API.call(
|
||||
return request(
|
||||
`groups/${params.groupId}/members/${params.userId}/roles/${params.roleId}`,
|
||||
{
|
||||
method: 'PUT'
|
||||
@@ -192,7 +217,6 @@ const groupReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// window.API.$emit('GROUP:MEMBER:ROLE:CHANGE', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -205,7 +229,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
removeGroupMemberRole(params) {
|
||||
return window.API.call(
|
||||
return request(
|
||||
`groups/${params.groupId}/members/${params.userId}/roles/${params.roleId}`,
|
||||
{
|
||||
method: 'DELETE'
|
||||
@@ -215,19 +239,17 @@ const groupReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// window.API.$emit('GROUP:MEMBER:ROLE:CHANGE', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
getGroupPermissions(params) {
|
||||
return window.API.call(`users/${params.userId}/groups/permissions`, {
|
||||
return request(`users/${params.userId}/groups/permissions`, {
|
||||
method: 'GET'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
window.API.$emit('GROUP:PERMISSIONS', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -240,7 +262,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroupPosts(params) {
|
||||
return window.API.call(`groups/${params.groupId}/posts`, {
|
||||
return request(`groups/${params.groupId}/posts`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -248,28 +270,23 @@ const groupReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
window.API.$emit('GROUP:POSTS', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
editGroupPost(params) {
|
||||
return window.API.call(
|
||||
`groups/${params.groupId}/posts/${params.postId}`,
|
||||
{
|
||||
method: 'PUT',
|
||||
params
|
||||
}
|
||||
).then((json) => {
|
||||
return request(`groups/${params.groupId}/posts/${params.postId}`, {
|
||||
method: 'PUT',
|
||||
params
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
window.API.$emit('GROUP:POST', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
createGroupPost(params) {
|
||||
return window.API.call(`groups/${params.groupId}/posts`, {
|
||||
return request(`groups/${params.groupId}/posts`, {
|
||||
method: 'POST',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -277,7 +294,6 @@ const groupReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
window.API.$emit('GROUP:POST', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -289,17 +305,13 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroupMember(params) {
|
||||
return window.API.call(
|
||||
`groups/${params.groupId}/members/${params.userId}`,
|
||||
{
|
||||
method: 'GET'
|
||||
}
|
||||
).then((json) => {
|
||||
return request(`groups/${params.groupId}/members/${params.userId}`, {
|
||||
method: 'GET'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// window.API.$emit('GROUP:MEMBER', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -312,7 +324,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroupMembers(params) {
|
||||
return window.API.call(`groups/${params.groupId}/members`, {
|
||||
return request(`groups/${params.groupId}/members`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -320,7 +332,6 @@ const groupReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
window.API.$emit('GROUP:MEMBERS', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -334,7 +345,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroupMembersSearch(params) {
|
||||
return window.API.call(`groups/${params.groupId}/members/search`, {
|
||||
return request(`groups/${params.groupId}/members/search`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -352,7 +363,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
blockGroup(params) {
|
||||
return window.API.call(`groups/${params.groupId}/block`, {
|
||||
return request(`groups/${params.groupId}/block`, {
|
||||
method: 'POST'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
@@ -370,12 +381,9 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
unblockGroup(params) {
|
||||
return window.API.call(
|
||||
`groups/${params.groupId}/members/${params.userId}`,
|
||||
{
|
||||
method: 'DELETE'
|
||||
}
|
||||
).then((json) => {
|
||||
return request(`groups/${params.groupId}/members/${params.userId}`, {
|
||||
method: 'DELETE'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
@@ -391,7 +399,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
sendGroupInvite(params) {
|
||||
return window.API.call(`groups/${params.groupId}/invites`, {
|
||||
return request(`groups/${params.groupId}/invites`, {
|
||||
method: 'POST',
|
||||
params: {
|
||||
userId: params.userId
|
||||
@@ -401,7 +409,6 @@ const groupReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
window.API.$emit('GROUP:INVITE', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -413,18 +420,13 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
kickGroupMember(params) {
|
||||
return window.API.call(
|
||||
`groups/${params.groupId}/members/${params.userId}`,
|
||||
{
|
||||
method: 'DELETE'
|
||||
}
|
||||
).then((json) => {
|
||||
return request(`groups/${params.groupId}/members/${params.userId}`, {
|
||||
method: 'DELETE'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// useless code
|
||||
// window.API.$emit('GROUP:MEMBER:KICK', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -433,7 +435,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
banGroupMember(params) {
|
||||
return window.API.call(`groups/${params.groupId}/bans`, {
|
||||
return request(`groups/${params.groupId}/bans`, {
|
||||
method: 'POST',
|
||||
params: {
|
||||
userId: params.userId
|
||||
@@ -443,24 +445,17 @@ const groupReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// useless code
|
||||
// window.API.$emit('GROUP:MEMBER:BAN', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
unbanGroupMember(params) {
|
||||
return window.API.call(
|
||||
`groups/${params.groupId}/bans/${params.userId}`,
|
||||
{
|
||||
method: 'DELETE'
|
||||
}
|
||||
).then((json) => {
|
||||
return request(`groups/${params.groupId}/bans/${params.userId}`, {
|
||||
method: 'DELETE'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// useless code
|
||||
// window.API.$emit('GROUP:MEMBER:UNBAN', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -469,97 +464,73 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
deleteSentGroupInvite(params) {
|
||||
return window.API.call(
|
||||
`groups/${params.groupId}/invites/${params.userId}`,
|
||||
{
|
||||
method: 'DELETE'
|
||||
}
|
||||
).then((json) => {
|
||||
return request(`groups/${params.groupId}/invites/${params.userId}`, {
|
||||
method: 'DELETE'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// useless code
|
||||
// window.API.$emit('GROUP:INVITE:DELETE', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
deleteBlockedGroupRequest(params) {
|
||||
return window.API.call(
|
||||
`groups/${params.groupId}/members/${params.userId}`,
|
||||
{
|
||||
method: 'DELETE'
|
||||
}
|
||||
).then((json) => {
|
||||
return request(`groups/${params.groupId}/members/${params.userId}`, {
|
||||
method: 'DELETE'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// useless code
|
||||
// window.API.$emit('GROUP:BLOCKED:DELETE', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
acceptGroupInviteRequest(params) {
|
||||
return window.API.call(
|
||||
`groups/${params.groupId}/requests/${params.userId}`,
|
||||
{
|
||||
method: 'PUT',
|
||||
params: {
|
||||
action: 'accept'
|
||||
}
|
||||
return request(`groups/${params.groupId}/requests/${params.userId}`, {
|
||||
method: 'PUT',
|
||||
params: {
|
||||
action: 'accept'
|
||||
}
|
||||
).then((json) => {
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// useless code
|
||||
// window.API.$emit('GROUP:INVITE:ACCEPT', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
rejectGroupInviteRequest(params) {
|
||||
return window.API.call(
|
||||
`groups/${params.groupId}/requests/${params.userId}`,
|
||||
{
|
||||
method: 'PUT',
|
||||
params: {
|
||||
action: 'reject'
|
||||
}
|
||||
return request(`groups/${params.groupId}/requests/${params.userId}`, {
|
||||
method: 'PUT',
|
||||
params: {
|
||||
action: 'reject'
|
||||
}
|
||||
).then((json) => {
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// useless code
|
||||
// window.API.$emit('GROUP:INVITE:REJECT', args);
|
||||
|
||||
return args;
|
||||
});
|
||||
},
|
||||
blockGroupInviteRequest(params) {
|
||||
return window.API.call(
|
||||
`groups/${params.groupId}/requests/${params.userId}`,
|
||||
{
|
||||
method: 'PUT',
|
||||
params: {
|
||||
action: 'reject',
|
||||
block: true
|
||||
}
|
||||
return request(`groups/${params.groupId}/requests/${params.userId}`, {
|
||||
method: 'PUT',
|
||||
params: {
|
||||
action: 'reject',
|
||||
block: true
|
||||
}
|
||||
).then((json) => {
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// useless code
|
||||
// window.API.$emit('GROUP:INVITE:BLOCK', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
getGroupBans(params) {
|
||||
return window.API.call(`groups/${params.groupId}/bans`, {
|
||||
return request(`groups/${params.groupId}/bans`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -575,7 +546,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroupAuditLogTypes(params) {
|
||||
return window.API.call(`groups/${params.groupId}/auditLogTypes`, {
|
||||
return request(`groups/${params.groupId}/auditLogTypes`, {
|
||||
method: 'GET'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
@@ -590,7 +561,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroupLogs(params) {
|
||||
return window.API.call(`groups/${params.groupId}/auditLogs`, {
|
||||
return request(`groups/${params.groupId}/auditLogs`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -606,7 +577,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroupInvites(params) {
|
||||
return window.API.call(`groups/${params.groupId}/invites`, {
|
||||
return request(`groups/${params.groupId}/invites`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -622,7 +593,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroupJoinRequests(params) {
|
||||
return window.API.call(`groups/${params.groupId}/requests`, {
|
||||
return request(`groups/${params.groupId}/requests`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -630,7 +601,6 @@ const groupReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// window.API.$emit('GROUP:JOINREQUESTS', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -639,8 +609,8 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroupInstances(params) {
|
||||
return window.API.call(
|
||||
`users/${window.API.currentUser.id}/instances/groups/${params.groupId}`,
|
||||
return request(
|
||||
`users/${getCurrentUserId()}/instances/groups/${params.groupId}`,
|
||||
{
|
||||
method: 'GET'
|
||||
}
|
||||
@@ -657,7 +627,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroupRoles(params) {
|
||||
return window.API.call(`groups/${params.groupId}/roles`, {
|
||||
return request(`groups/${params.groupId}/roles`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -665,22 +635,16 @@ const groupReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
// useless code
|
||||
// this.$emit('GROUP:ROLES', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
getUsersGroupInstances() {
|
||||
return window.API.call(
|
||||
`users/${window.API.currentUser.id}/instances/groups`,
|
||||
{
|
||||
method: 'GET'
|
||||
}
|
||||
).then((json) => {
|
||||
return request(`users/${getCurrentUserId()}/instances/groups`, {
|
||||
method: 'GET'
|
||||
}).then((json) => {
|
||||
const args = {
|
||||
json
|
||||
};
|
||||
window.API.$emit('GROUP:USER:INSTANCES', args);
|
||||
return args;
|
||||
});
|
||||
},
|
||||
@@ -696,7 +660,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
groupSearch(params) {
|
||||
return window.API.call(`groups`, {
|
||||
return request(`groups`, {
|
||||
method: 'GET',
|
||||
params
|
||||
}).then((json) => {
|
||||
@@ -717,7 +681,7 @@ const groupReq = {
|
||||
* @return { Promise<{json: any, params}> }
|
||||
*/
|
||||
getGroupGallery(params) {
|
||||
return window.API.call(
|
||||
return request(
|
||||
`groups/${params.groupId}/galleries/${params.galleryId}`,
|
||||
{
|
||||
method: 'GET',
|
||||
@@ -735,10 +699,9 @@ const groupReq = {
|
||||
});
|
||||
}
|
||||
|
||||
// no place to use this
|
||||
// getRequestedGroups() {
|
||||
// return window.API.call(
|
||||
// `users/${window.API.currentUser.id}/groups/requested`,
|
||||
// return request(
|
||||
// `users/${API.currentUser.id}/groups/requested`,
|
||||
// {
|
||||
// method: 'GET'
|
||||
// }
|
||||
@@ -746,18 +709,17 @@ const groupReq = {
|
||||
// const args = {
|
||||
// json
|
||||
// };
|
||||
// window.API.$emit('GROUP:REQUESTED', args);
|
||||
// API.$emit('GROUP:REQUESTED', args);
|
||||
// return args;
|
||||
// });
|
||||
// }
|
||||
|
||||
// ----------------- left over code -----------------
|
||||
// /**
|
||||
// * @param {{ groupId: string }} params
|
||||
// * @return { Promise<{json: any, params}> }
|
||||
// */
|
||||
// API.getGroupAnnouncement = function (params) {
|
||||
// return this.call(`groups/${params.groupId}/announcement`, {
|
||||
// return request(`groups/${params.groupId}/announcement`, {
|
||||
// method: 'GET'
|
||||
// }).then((json) => {
|
||||
// var args = {
|
||||
|
||||
Reference in New Issue
Block a user