mirror of
https://github.com/lnbits/lnbits.git
synced 2025-07-28 05:32:40 +02:00
support all the currencies.
This commit is contained in:
@@ -24,7 +24,7 @@ new Vue({
|
|||||||
itemDialog: {
|
itemDialog: {
|
||||||
show: false,
|
show: false,
|
||||||
data: {...defaultItemData},
|
data: {...defaultItemData},
|
||||||
units: ['sat', 'USD']
|
units: ['sat']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -207,5 +207,14 @@ new Vue({
|
|||||||
created() {
|
created() {
|
||||||
this.selectedWallet = this.g.user.wallets[0]
|
this.selectedWallet = this.g.user.wallets[0]
|
||||||
this.loadShop()
|
this.loadShop()
|
||||||
|
|
||||||
|
LNbits.api
|
||||||
|
.request('GET', '/offlineshop/api/v1/currencies')
|
||||||
|
.then(response => {
|
||||||
|
this.itemDialog = {...this.itemDialog, units: ['sat', ...response.data]}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
LNbits.utils.notifyApiError(err)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@@ -3,6 +3,7 @@ from http import HTTPStatus
|
|||||||
from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl # type: ignore
|
from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl # type: ignore
|
||||||
|
|
||||||
from lnbits.decorators import api_check_wallet_key, api_validate_post_request
|
from lnbits.decorators import api_check_wallet_key, api_validate_post_request
|
||||||
|
from lnbits.utils.exchange_rates import currencies
|
||||||
|
|
||||||
from . import offlineshop_ext
|
from . import offlineshop_ext
|
||||||
from .crud import (
|
from .crud import (
|
||||||
@@ -16,6 +17,11 @@ from .crud import (
|
|||||||
from .models import ShopCounter
|
from .models import ShopCounter
|
||||||
|
|
||||||
|
|
||||||
|
@offlineshop_ext.route("/api/v1/currencies", methods=["GET"])
|
||||||
|
async def api_list_currencies_available():
|
||||||
|
return jsonify(list(currencies.keys()))
|
||||||
|
|
||||||
|
|
||||||
@offlineshop_ext.route("/api/v1/offlineshop", methods=["GET"])
|
@offlineshop_ext.route("/api/v1/offlineshop", methods=["GET"])
|
||||||
@api_check_wallet_key("invoice")
|
@api_check_wallet_key("invoice")
|
||||||
async def api_shop_from_wallet():
|
async def api_shop_from_wallet():
|
||||||
@@ -51,7 +57,7 @@ async def api_shop_from_wallet():
|
|||||||
"description": {"type": "string", "empty": False, "required": True},
|
"description": {"type": "string", "empty": False, "required": True},
|
||||||
"image": {"type": "string", "required": False, "nullable": True},
|
"image": {"type": "string", "required": False, "nullable": True},
|
||||||
"price": {"type": "number", "required": True},
|
"price": {"type": "number", "required": True},
|
||||||
"unit": {"type": "string", "allowed": ["sat", "USD"], "required": True},
|
"unit": {"type": "string", "required": True},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
async def api_add_or_update_item(item_id=None):
|
async def api_add_or_update_item(item_id=None):
|
||||||
|
Reference in New Issue
Block a user