diff --git a/.env b/.env index 9b3cc85..b49b782 100644 --- a/.env +++ b/.env @@ -5,4 +5,5 @@ NEXT_PUBLIC_IDP_Tokendpoint = $NEXT_PUBLIC_COGNITO_URL/oauth2/token NEXT_PUBLIC_QUEMISTRY_DOMAIN =https://dkraju438qs82.cloudfront.net NEXT_PUBLIC_RedirectUrl = $NEXT_PUBLIC_QUEMISTRY_DOMAIN/auth/google NEXT_PUBLIC_QUEMISTRY_GATEWAY_URL=https://dummyUrl -NEXT_PUBLIC_QUEMISTRY_AUTH_URL = $NEXT_PUBLIC_QUEMISTRY_GATEWAY_URL/auth \ No newline at end of file +NEXT_PUBLIC_QUEMISTRY_AUTH_URL = $NEXT_PUBLIC_QUEMISTRY_GATEWAY_URL/auth +NEXT_PUBLIC_QUEMISTRY_QUESTIONS_URL = $NEXT_PUBLIC_QUEMISTRY_GATEWAY_URL/questions \ No newline at end of file diff --git a/service/QuestionsService.tsx b/service/QuestionsService.tsx index 5a67dd1..4ec6315 100644 --- a/service/QuestionsService.tsx +++ b/service/QuestionsService.tsx @@ -1,10 +1,21 @@ import { Questions } from '@/types'; +const QuesionsSvcUrl = process.env.NEXT_PUBLIC_QUEMISTRY_QUESTIONS_URL || '' + export const QuestionsService = { getMCQ() { - return fetch('/demo/data/questions.json', { headers: { 'Cache-Control': 'no-cache' } }) - .then((res) => res.json()) - .then((d) => d.data as Questions.MCQ[]); + return fetch(QuesionsSvcUrl, { + headers: { + 'Content-Type': 'application/json' + }, + credentials: "include" + }) + .then((res) => { + return res.json(); + }) + .then((data) => { + return data.mcqs as Questions.MCQ[]} + ); }, getTopics() { return fetch('/demo/data/topics.json', { headers: { 'Cache-Control': 'no-cache' } }) diff --git a/types/questions.d.ts b/types/questions.d.ts index ef8ac7c..7f19af3 100644 --- a/types/questions.d.ts +++ b/types/questions.d.ts @@ -3,7 +3,7 @@ declare namespace Questions { interface MCQ { id?: number; stem: string; - option: Answer[]; + option: Option[]; isAnswer: number; topics: Topic[]; skills: Skills[];