Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getStories(type: string) {
if (Ionic.isServer) return;
// reset page number
this.page = 1;
// this is definitely not the best solution
// working on something more elegant, but this
// gets the job done for the moment
switch (type) {
case 'news':
this.firstSelectedClass = true;
this.secondSelectedClass = false;
this.thirdSelectedClass = false;
this.fourthSelectedClass = false;
break;
case 'show':
this.secondSelectedClass = true;
comments(story: any) {
if (Ionic.isServer) return;
Ionic.controller('loading', { content: 'fetching comments...' }).then(loading => {
loading.present();
this.fakeFetch(`${this.apiRootUrl}/item/${story.id}`).then((data: { [key: string]: any }) => {
setTimeout(() => {
loading.dismiss().then(() => {
Ionic.controller('modal', { component: 'comments-page', componentProps: { comments: data.comments, storyId: story.id } }).then(modal => {
console.log('modal created');
modal.present().then(() => {
console.log('modal finished transitioning in, commments: ', modal.componentProps.comments);
});
});
});
}, 300);