Revize dd270a41
Přidáno uživatelem Václav Honzík před asi 2 roky(ů)
frontend/src/features/TrackingTool/TrackingTool.tsx | ||
---|---|---|
18 | 18 |
import { formatHtmlStringToReactDom } from '../../utils/formatting/HtmlUtils' |
19 | 19 |
import MapPath from './MapPath' |
20 | 20 |
import EditIcon from '@mui/icons-material/Edit' |
21 |
import { useSelector } from 'react-redux' |
|
21 |
import { useDispatch, useSelector } from 'react-redux'
|
|
22 | 22 |
import { RootState } from '../redux/store' |
23 |
import { consumeErr as consumeError } from './trackingToolSlice' |
|
24 |
import { showNotification } from '../Notification/notificationSlice' |
|
23 | 25 |
|
24 | 26 |
// Page with tracking tool |
25 | 27 |
const TrackingTool = () => { |
... | ... | |
35 | 37 |
// map.flyTo(mapCenter, mapConfig.defaultZoom) |
36 | 38 |
// }, [map, mapCenter]) |
37 | 39 |
|
40 |
// Consume any error |
|
41 |
const err = useSelector((state: RootState) => state.trackingTool.lastError) |
|
42 |
const dispatch = useDispatch() |
|
43 |
|
|
44 |
useEffect(() => { |
|
45 |
console.log('oi') |
|
46 |
if (!err) { |
|
47 |
return |
|
48 |
} |
|
49 |
const error = `${err}` |
|
50 |
dispatch(consumeError()) |
|
51 |
dispatch(showNotification({ |
|
52 |
message: error, |
|
53 |
severity: 'error', |
|
54 |
|
|
55 |
})) |
|
56 |
}, [err, dispatch]) |
|
38 | 57 |
|
39 | 58 |
return ( |
40 | 59 |
<Fragment> |
... | ... | |
118 | 137 |
attribution={mapConfig.attribution} |
119 | 138 |
url={mapConfig.url} |
120 | 139 |
/> |
121 |
{pathVariants && |
|
122 |
pathVariants.map((pathVariant, idx) => ( |
|
123 |
<MapPath |
|
124 |
key={idx} |
|
125 |
pathVariant={pathVariant} |
|
126 |
idx={idx} |
|
127 |
/> |
|
128 |
))} |
|
140 |
{pathVariants?.map((pathVariant, idx) => ( |
|
141 |
<MapPath |
|
142 |
pathVariant={pathVariant} |
|
143 |
idx={idx} /> |
|
144 |
))} |
|
129 | 145 |
</MapContainer> |
130 | 146 |
</Grid> |
131 | 147 |
</Grid> |
Také k dispozici: Unified diff
path autorefresh works as intended
re #9629