mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-15 12:53:51 +02:00
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
import {
|
|
useFriendStore,
|
|
useInstanceStore,
|
|
useLocationStore,
|
|
useUserStore
|
|
} from '../stores';
|
|
import {
|
|
checkCanInvite as checkCanInvitePure,
|
|
checkCanInviteSelf as checkCanInviteSelfPure
|
|
} from '../shared/utils/invite';
|
|
|
|
/**
|
|
* Composable that provides store-aware invite check functions.
|
|
* Delegates to the pure utility functions after resolving store data.
|
|
*/
|
|
export function useInviteChecks() {
|
|
const userStore = useUserStore();
|
|
const locationStore = useLocationStore();
|
|
const instanceStore = useInstanceStore();
|
|
const friendStore = useFriendStore();
|
|
|
|
function checkCanInvite(location) {
|
|
return checkCanInvitePure(location, {
|
|
currentUserId: userStore.currentUser.id,
|
|
lastLocationStr: locationStore.lastLocation.location,
|
|
cachedInstances: instanceStore.cachedInstances
|
|
});
|
|
}
|
|
|
|
function checkCanInviteSelf(location) {
|
|
return checkCanInviteSelfPure(location, {
|
|
currentUserId: userStore.currentUser.id,
|
|
cachedInstances: instanceStore.cachedInstances,
|
|
friends: friendStore.friends
|
|
});
|
|
}
|
|
|
|
return { checkCanInvite, checkCanInviteSelf };
|
|
}
|