From 9f3947a9d6ec7b0bce8d01078fc86ce52f177840 Mon Sep 17 00:00:00 2001 From: prahalad Date: Tue, 2 Nov 2021 19:55:45 +0530 Subject: [PATCH] Integrated Faq with Api --- src/app/faq/faq.component.html | 29 +++++++++++------------------ src/app/faq/faq.component.scss | 22 +++++++++++++++++++--- src/app/faq/faq.component.ts | 12 ++++++++---- src/app/services/faq.service.ts | 19 ++++++++++--------- 4 files changed, 48 insertions(+), 34 deletions(-) diff --git a/src/app/faq/faq.component.html b/src/app/faq/faq.component.html index 3a5ade5..3322f8f 100644 --- a/src/app/faq/faq.component.html +++ b/src/app/faq/faq.component.html @@ -26,29 +26,22 @@ - + \ No newline at end of file diff --git a/src/app/faq/faq.component.scss b/src/app/faq/faq.component.scss index 3ab697f..4815a02 100644 --- a/src/app/faq/faq.component.scss +++ b/src/app/faq/faq.component.scss @@ -68,6 +68,8 @@ } .topic-list { + display: flex; + flex-direction: column; width: 25%; height: calc(100vh - 200px); overflow: auto; @@ -227,7 +229,7 @@ width: 100%; align-items: center; justify-content: space-between; - font-size: 15px; + font-size: 20px; font-weight: 500; color: var(--dark-grey); border-bottom: 1px solid #efefef; @@ -255,17 +257,31 @@ } } + .subquestion{ + margin-bottom: 20px; + margin-top: 10px; + } + p { color: var(--grey); font-size: 13px; + + @media screen and (max-width: 1023px) { + margin-top: 0px; + font-size: 12px; + } + } + h3 { + color: var(--dark-grey); + font-size: 16px; line-height: 1.5; - margin-top: 15px; - padding-bottom: 10px; + font-weight: 500; @media screen and (max-width: 1023px) { margin-top: 0px; font-size: 12px; } } + } } diff --git a/src/app/faq/faq.component.ts b/src/app/faq/faq.component.ts index 0b922a8..45004e3 100644 --- a/src/app/faq/faq.component.ts +++ b/src/app/faq/faq.component.ts @@ -9,14 +9,18 @@ import { FaqService } from '../services/faq.service'; export class FaqComponent implements OnInit { showDetails: boolean = true; selectedCard: number = null; + allFaqs: any = []; + selectedQuestions: number = 0; constructor(private faqService: FaqService) { } ngOnInit() { - window.innerWidth <= 1023? this.selectedCard = null: this.selectedCard = 1; - - - this.faqService.getFaqContent().then(data => console.log(data)); + window.innerWidth <= 1023 ? this.selectedCard = null : this.selectedCard = 1; + this.faqService.mallFaqs().then((response) => { + this.allFaqs = response + }, err => { + console.log("Unable to fetch Faqs") + }) } } diff --git a/src/app/services/faq.service.ts b/src/app/services/faq.service.ts index e6fa5e9..d7f211c 100644 --- a/src/app/services/faq.service.ts +++ b/src/app/services/faq.service.ts @@ -6,20 +6,21 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; providedIn: 'root' }) export class FaqService { - + constructor( private http: HttpClient ) { } - getFaqContent() { + async mallFaqs() { const httpOptions = { - headers: new HttpHeaders({ - 'Access-Control-Allow-Origin': '*', - 'Content-Type': 'application/json', - 'Authorization': 'Bearer ' + localStorage.token - }) - }; - return this.http.get(URL + '/api/maioraservice/faq/getall/', httpOptions).toPromise(); + headers: new HttpHeaders({ + 'Access-Control-Allow-Origin': '*', + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + localStorage.access_Token + }) + }; + + return await this.http.get(URL + '/api/maioraservice/faq/getall/', httpOptions).toPromise() } }