Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 81698b9a

Přidáno uživatelem Václav Honzík před více než 2 roky(ů)

merge fixes

Zobrazit rozdíly:

frontend/src/features/TrackingTool/trackingToolSlice.ts
17 17
    activePaths: Set<number> // indices of the active paths
18 18
    // trigger to close the dialog when API call is finished
19 19
    dialogApiCallSuccess: boolean
20
    pathsPerPage: number // max number of paths to show on the map at once
21
    currentPage: number // current page of paths - starts from 0
20 22
}
21 23

  
24
const defaultPathsPerPage = 5
25

  
22 26
const initialState: TrackingToolState = {
23 27
    isLoading: false,
24 28
    mapCenter: [
......
28 32
    primaryPathIdx: 0,
29 33
    activePaths: new Set(),
30 34
    dialogApiCallSuccess: true,
35
    pathsPerPage: defaultPathsPerPage,
36
    currentPage: 0,
31 37
}
32 38

  
33 39
// Returns tuple of average latitude and longitude
......
56 62
            ...state,
57 63
            dialogApiCallSuccess: false,
58 64
        }),
59
        clear: (state: TrackingToolState) => ({...initialState})
65
        setPage: (state: TrackingToolState, action: any) => ({
66
            ...state,
67
            currentPage: action.payload,
68
        }),
69
        clear: () => ({...initialState})
60 70
    },
61 71
    extraReducers: (builder) => {
62 72
        builder.addCase(sendTextForProcessing.fulfilled, (state, action) => {
......
75 85
                        : (state.mapCenter as LatLngTuple),
76 86
                isLoading: false,
77 87
                dialogApiCallSuccess: true,
88
                currentPage: 0,
78 89
            }
79 90
        })
80 91
        builder.addCase(sendTextForProcessing.rejected, (state, action) => ({
......
82 93
            lastError: action.error.message,
83 94
            isLoading: false,
84 95
            dialogApiCallSuccess: false,
96
            currentPage: 0,
85 97
        }))
86 98
        builder.addCase(sendTextForProcessing.pending, (state) => {
87 99
            return {

Také k dispozici: Unified diff