GpxDialog (working).

This commit is contained in:
vdv committed 2022-12-12 20:57:25 +01:00
1 parent 6da10713a0
commit daed8e5dc1
5 files changed
+29 -11

No files matched your search

+10 -7
View File
@@ -17,7 +17,7 @@ import Dialog from '../dialog';
//import GpxesIcon from '../../icons/adventure-journey-location-svgrepo-com.svg';
import style from './GpxDialog.module.css';
export const [currentGpxId, setCurrentGpxId] = createSignal<string>('');
export const [currentGpxId, setCurrentGpxId] = createSignal<string>('new');
const GpxDialog: Component<{}> = (props) => {
const [t] = useI18n();
@@ -30,10 +30,13 @@ const GpxDialog: Component<{}> = (props) => {
const handleClickOpen = async () => {
setOpen(true);
const newAllGpxes = await dispatch({
const newAllGpxes = (await dispatch({
action: 'getAllGpxesWithSummary',
});
setAllGpxes(newAllGpxes as any[]);
})) as any[];
setAllGpxes([
{ id: 'new', name: t('newGpx'), creator: 'dyomedea' },
...newAllGpxes,
]);
setSelectedGpxId(currentGpxId());
if (currentGpxId() !== '') {
const newGpx = await dispatch({
@@ -111,14 +114,14 @@ const GpxDialog: Component<{}> = (props) => {
};
const saveHandler = async (event: any) => {
setCurrentGpxId(selectedGpxId());
await dispatch({
const id = (await dispatch({
action: 'putGpx',
params: {
id: selectedGpxId(),
gpx: gpx(),
},
});
})) as string;
setCurrentGpxId(id);
setOpen(false);
};