Refresh after an order sync
This commit is contained in:
@@ -26,14 +26,16 @@
|
|||||||
async function sync(wOrderId: string) {
|
async function sync(wOrderId: string) {
|
||||||
syncingWOrderId = wOrderId;
|
syncingWOrderId = wOrderId;
|
||||||
loadError = null;
|
loadError = null;
|
||||||
|
let syncError: string | null = null;
|
||||||
try {
|
try {
|
||||||
const res = await api.commerce.orders.sync({ wOrderId }).post();
|
const res = await api.commerce.orders.sync({ wOrderId }).post();
|
||||||
if (res.error) throw res.error;
|
if (res.error) throw res.error;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
loadError = errorMessage(err);
|
syncError = errorMessage(err);
|
||||||
} finally {
|
|
||||||
syncingWOrderId = null;
|
|
||||||
}
|
}
|
||||||
|
await refresh();
|
||||||
|
if (syncError) loadError = syncError;
|
||||||
|
syncingWOrderId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refresh() {
|
async function refresh() {
|
||||||
|
|||||||
Reference in New Issue
Block a user