GpxDialog (working).
This commit is contained in:
1 parent
6da10713a0
commit
daed8e5dc1
5 files changed
+29
-11
No files matched your search
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user