mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
24 lines
761 B
JavaScript
24 lines
761 B
JavaScript
import consumer from "./consumer"
|
|
|
|
// Only create subscription if family feature is enabled
|
|
const familyFeaturesElement = document.querySelector('[data-family-members-features-value]');
|
|
const features = familyFeaturesElement ? JSON.parse(familyFeaturesElement.dataset.familyMembersFeaturesValue) : {};
|
|
|
|
if (features.family) {
|
|
consumer.subscriptions.create("FamilyLocationsChannel", {
|
|
connected() {
|
|
// Connected to family locations channel
|
|
},
|
|
|
|
disconnected() {
|
|
// Disconnected from family locations channel
|
|
},
|
|
|
|
received(data) {
|
|
// Pass data to family members controller if it exists
|
|
if (window.familyMembersController) {
|
|
window.familyMembersController.updateSingleMemberLocation(data);
|
|
}
|
|
}
|
|
});
|
|
}
|