@@ -18,6 +18,7 @@ import {
18
18
} from "@/lib/schemas/question-schema" ;
19
19
import QuestionFormModal from "./question-form-modal" ;
20
20
import { updateQuestion } from "@/lib/update-question" ;
21
+ import { questionServiceUri } from "@/lib/api-uri" ;
21
22
22
23
const fetcher = async ( url : string ) : Promise < Question [ ] > => {
23
24
const token = localStorage . getItem ( "jwtToken" ) ;
@@ -55,7 +56,7 @@ export default function QuestionListing() {
55
56
const [ search , setSearch ] = useState ( searchParams . get ( "search" ) || "" ) ;
56
57
57
58
const { data, isLoading, mutate } = useSWR (
58
- `http://localhost:8000 /questions?category=${ encodeURIComponent ( category ) } &complexity=${ encodeURIComponent ( complexity ) } &search=${ encodeURIComponent ( search ) } ` ,
59
+ `${ questionServiceUri } /questions?category=${ encodeURIComponent ( category ) } &complexity=${ encodeURIComponent ( complexity ) } &search=${ encodeURIComponent ( search ) } ` ,
59
60
fetcher ,
60
61
{
61
62
keepPreviousData : true ,
@@ -144,7 +145,7 @@ export default function QuestionListing() {
144
145
try {
145
146
const token = localStorage . getItem ( "jwtToken" ) ;
146
147
const response = await fetch (
147
- "http://localhost:8000/ questions/batch-upload" ,
148
+ ` ${ questionServiceUri } / questions/batch-upload` ,
148
149
{
149
150
method : "POST" ,
150
151
headers : {
@@ -189,7 +190,7 @@ export default function QuestionListing() {
189
190
190
191
try {
191
192
const response = await fetch (
192
- `http://localhost:8000 /questions/${ selectedQuestion . id } ` ,
193
+ `${ questionServiceUri } /questions/${ selectedQuestion . id } ` ,
193
194
{
194
195
method : "DELETE" ,
195
196
}
@@ -262,7 +263,7 @@ export default function QuestionListing() {
262
263
263
264
const handleCreate = async ( newQuestion : Question ) => {
264
265
try {
265
- const response = await fetch ( "http://localhost:8000/ questions" , {
266
+ const response = await fetch ( ` ${ questionServiceUri } / questions` , {
266
267
method : "POST" ,
267
268
headers : {
268
269
"Content-Type" : "application/json" ,
0 commit comments