瀏覽代碼

suggestion can be null

visuddhinanda 2 年之前
父節點
當前提交
1346510128
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      dashboard/src/reducers/pr-load.ts

+ 3 - 3
dashboard/src/reducers/pr-load.ts

@@ -4,7 +4,7 @@ import type { RootState } from "../store";
 import { ISuggestionData } from "../components/api/Suggestion";
 
 interface IState {
-  suggestion?: ISuggestionData;
+  suggestion?: ISuggestionData | null;
 }
 
 const initialState: IState = {};
@@ -13,7 +13,7 @@ export const slice = createSlice({
   name: "pr-load",
   initialState,
   reducers: {
-    refresh: (state, action: PayloadAction<ISuggestionData>) => {
+    refresh: (state, action: PayloadAction<ISuggestionData | null>) => {
       state.suggestion = action.payload;
     },
   },
@@ -21,7 +21,7 @@ export const slice = createSlice({
 
 export const { refresh } = slice.actions;
 
-export const prInfo = (state: RootState): ISuggestionData | undefined =>
+export const prInfo = (state: RootState): ISuggestionData | null | undefined =>
   state.prLoad.suggestion;
 
 export default slice.reducer;