import{router as t}from"@inertiajs/react";const s={syncTransaction(e,r){return new Promise(o=>{t.post(route(e,r),{},{preserveScroll:!0,onFinish:()=>o()})})},togglePromo(e){return new Promise(r=>{t.post(route("admin.topup.promo.toggle",e),{},{preserveScroll:!0,onFinish:()=>r()})})},deletePromo(e){return new Promise(r=>{t.delete(route("admin.topup.promo.destroy",e),{onFinish:()=>r()})})},async checkBalance(e){try{const o=await(await fetch(route(e))).json();if(o.Data?.MerchantBalance!==void 0)return o.Data.MerchantBalance;if(o.error)throw new Error(o.error);return null}catch(r){throw r}}};export{s as t};
