Skip to content

Commit

Permalink
fix: bug fix for milestone 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Daviancold committed Sep 30, 2024
1 parent 388541e commit 1ab35be
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions frontend/components/customs/datatable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ export default function Datatable({
paginationHandler(newPage, pagination.limit)
}

const displayPageNum = (): string => {
let current = pagination.currentPage
const total = pagination.totalPages
if (total == 0) {
current = 0
}
return `${current} of ${total}`
}

return (
<>
<Table>
Expand Down Expand Up @@ -151,9 +160,7 @@ export default function Datatable({
>
<LeftIcon color="#9ca3af" />
</Button>
<span>
{pagination.currentPage} of {pagination.totalPages}
</span>
<span>{displayPageNum()}</span>
<Button
variant="icon"
size={'icon'}
Expand Down
2 changes: 1 addition & 1 deletion frontend/services/axios-middleware2.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios'

const api = axios.create({
baseURL: 'http://localhost:3003',
baseURL: 'http://localhost:3004',
})

// Response interceptor for all axios calls
Expand Down
2 changes: 1 addition & 1 deletion frontend/services/question-service-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import axiosInstance from './axios-middleware2'
export const getQuestionsRequest = async (data: IGetQuestions): Promise<IQuestionsApi | undefined> => {
try {
let params: IGetQuestionsDto = {
page: data.page,
page: data.page == 0 ? 1 : data.page,
limit: data.limit,
}
if (data.sortBy && data.sortBy.direction !== SortDirection.NONE) {
Expand Down

0 comments on commit 1ab35be

Please sign in to comment.