mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-20 07:13:51 +02:00
refactor store
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { patchAndRefetchActiveQuery, queryKeys } from '../queries';
|
||||
import { request } from '../service/request';
|
||||
import { useUserStore } from '../stores';
|
||||
import { applyCurrentUser } from '../coordinators/userCoordinator';
|
||||
|
||||
const avatarReq = {
|
||||
/**
|
||||
@@ -65,7 +66,7 @@ const avatarReq = {
|
||||
* @returns {Promise<{json: any, params}>}
|
||||
*/
|
||||
selectAvatar(params) {
|
||||
const userStore = useUserStore();
|
||||
|
||||
return request(`avatars/${params.avatarId}/select`, {
|
||||
method: 'PUT',
|
||||
params
|
||||
@@ -74,7 +75,7 @@ const avatarReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
const ref = userStore.applyCurrentUser(json);
|
||||
const ref = applyCurrentUser(json);
|
||||
patchAndRefetchActiveQuery({
|
||||
queryKey: queryKeys.user(ref.id),
|
||||
nextData: {
|
||||
@@ -97,7 +98,7 @@ const avatarReq = {
|
||||
* @returns { Promise<{json: any, params}> }
|
||||
*/
|
||||
selectFallbackAvatar(params) {
|
||||
const userStore = useUserStore();
|
||||
|
||||
return request(`avatars/${params.avatarId}/selectfallback`, {
|
||||
method: 'PUT',
|
||||
params
|
||||
@@ -106,7 +107,7 @@ const avatarReq = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
const ref = userStore.applyCurrentUser(json);
|
||||
const ref = applyCurrentUser(json);
|
||||
patchAndRefetchActiveQuery({
|
||||
queryKey: queryKeys.user(ref.id),
|
||||
nextData: {
|
||||
|
||||
Reference in New Issue
Block a user