File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
frontend/src/app/dashboard/_components/QuestionTable Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,19 @@ import { QuestionsResponse } from "@/types/Question";
6
6
import { CategoriesResponse } from "@/types/Category" ;
7
7
import { questionTableColumns } from "./column" ;
8
8
import { DataTable } from "./data-table" ;
9
+ import { redirect } from "next/navigation" ;
9
10
10
11
export default async function QuestionTable ( ) {
11
12
const questionsResponse : QuestionsResponse = await getQuestions ( ) ;
12
13
const categoriesResponse : CategoriesResponse = await getQuestionCategories ( ) ;
13
14
15
+ if (
16
+ questionsResponse . statusCode === 401 ||
17
+ categoriesResponse . statusCode === 401
18
+ ) {
19
+ redirect ( "/signin" ) ;
20
+ }
21
+
14
22
if ( ! questionsResponse . data ) {
15
23
return < div > { questionsResponse . message } </ div > ;
16
24
}
You can’t perform that action at this time.
0 commit comments