Working on Wpt save after edition.
This commit is contained in:
1 parent
c8a8622c91
commit
156fefae3b
6 files changed
+48
-6
No files matched your search
@@ -11,7 +11,7 @@ const methods = {
|
||||
|
||||
const changeHandler = async (change: any) => {
|
||||
console.log({ caller: 'ChangeHandler', change });
|
||||
const { id } = change.id;
|
||||
const { id } = change;
|
||||
if (!globalThis.watches) {
|
||||
globalThis.watches = new Map();
|
||||
}
|
||||
@@ -19,7 +19,7 @@ const changeHandler = async (change: any) => {
|
||||
if (params) {
|
||||
const { method, _dispatchId, id, ...otherParams } = params;
|
||||
const returnValue = await methods[<keyof typeof methods>method](params);
|
||||
if (false) {
|
||||
if (returnValue) {
|
||||
returnAgain(_dispatchId, returnValue);
|
||||
}
|
||||
}
|
||||
|
||||
+14
-1
@@ -43,9 +43,22 @@ export const putNewWpt = async (id?: IdGpx | IdWpt) => {
|
||||
return finalId as IdWpt;
|
||||
};
|
||||
|
||||
export const putWpt = async (params: any) => {
|
||||
console.log({ caller: 'putWpt', params });
|
||||
const { id, wpt } = params;
|
||||
await put(
|
||||
id,
|
||||
'wpt',
|
||||
(_) => {
|
||||
return wpt;
|
||||
},
|
||||
wpt
|
||||
);
|
||||
return id;
|
||||
};
|
||||
|
||||
export const getWpt = async (params: any) => {
|
||||
const { id } = params;
|
||||
const doc = await get(id);
|
||||
return doc.doc;
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user