-
Notifications
You must be signed in to change notification settings - Fork 179
/
relatedSpaces.js
42 lines (39 loc) · 1.28 KB
/
relatedSpaces.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { LightningElement, api, wire } from 'lwc';
import getRelatedSpaces from '@salesforce/apex/marketServices.getRelatedSpaces';
import { NavigationMixin } from 'lightning/navigation';
export default class RelatedSpaces extends NavigationMixin(LightningElement) {
@api recordId;
records;
errorMsg;
msgForUser;
noRecords = false;
@wire(getRelatedSpaces, { recordId: '$recordId' })
wiredSpaces({ error, data }) {
if (error) {
this.errorMsg = error;
this.msgForUser = 'There was an issue loading related market data.';
} else if (data) {
if (data.length) {
this.records = data.map((record) => {
return { record, muted: false };
});
this.noRecords = false;
} else {
this.noRecords = true;
}
}
}
handleItemSelect(event) {
event.stopPropagation();
if (event.detail.recordId) {
this[NavigationMixin.Navigate]({
type: 'standard__recordPage',
attributes: {
recordId: event.detail.recordId,
objectApiName: 'Space__c',
actionName: 'view'
}
});
}
}
}