diff --git a/lnbits/core/static/js/wallet.js b/lnbits/core/static/js/wallet.js index 8e782c548..ed997ab43 100644 --- a/lnbits/core/static/js/wallet.js +++ b/lnbits/core/static/js/wallet.js @@ -617,11 +617,12 @@ new Vue({ }) }, updateWalletName: function () { + console.log(this.newName, this.g) let newName = this.newName + let adminkey = this.g.wallet.adminkey if (!newName || !newName.length) return - // let data = {name: newName} LNbits.api - .request('PUT', '/api/v1/wallet/' + newName, this.g.wallet.adminkey, {}) + .request('PUT', '/api/v1/wallet/' + newName, adminkey, {}) .then(res => { this.newName = '' this.$q.notify({ diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index 0e88b5c85..3be3a460e 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -7,7 +7,7 @@ from typing import Dict, List, Optional, Union from urllib.parse import ParseResult, parse_qs, urlencode, urlparse, urlunparse import httpx -from fastapi import Query, Request, Header +from fastapi import Header, Query, Request from fastapi.exceptions import HTTPException from fastapi.param_functions import Depends from fastapi.params import Body @@ -23,7 +23,7 @@ from lnbits.decorators import ( WalletInvoiceKeyChecker, WalletTypeInfo, get_key_type, - require_admin_key + require_admin_key, ) from lnbits.helpers import url_for, urlsafe_short_hash from lnbits.requestvars import g @@ -99,7 +99,7 @@ async def api_update_balance( @core_app.put("/api/v1/wallet/{new_name}") async def api_update_wallet( - new_name: str, wallet: WalletTypeInfo = Depends(WalletAdminKeyChecker()) + new_name: str, wallet: WalletTypeInfo = Depends(require_admin_key) ): await update_wallet(wallet.wallet.id, new_name) return {