diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx index 4a8162611..6c5e7a514 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/update/index.tsx @@ -13,18 +13,19 @@ You should have received a copy of the GNU General Public License along with GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ +import { HttpStatusCode } from "@gnu-taler/taler-util"; import { ErrorType, HttpError, HttpResponse, useTranslationContext, } from "@gnu-taler/web-util/browser"; -import { Fragment, h, VNode } from "preact"; +import { Fragment, VNode, h } from "preact"; import { useState } from "preact/hooks"; import { Loading } from "../../../components/exception/loading.js"; import { NotificationCard } from "../../../components/menu/index.js"; import { useInstanceContext } from "../../../context/instance.js"; -import { MerchantBackend } from "../../../declaration.js"; +import { AccessToken, MerchantBackend } from "../../../declaration.js"; import { useInstanceAPI, useInstanceDetails, @@ -33,7 +34,6 @@ import { } from "../../../hooks/instance.js"; import { Notification } from "../../../utils/types.js"; import { UpdatePage } from "./UpdatePage.js"; -import { HttpStatusCode } from "@gnu-taler/taler-util"; export interface Props { onBack: () => void; @@ -73,10 +73,9 @@ function CommonUpdate( MerchantBackend.ErrorDetail >, updateInstance: any, - clearToken: any, - setNewToken: any, + clearToken: () => Promise<void>, + setNewToken: (t: AccessToken) => Promise<void>, ): VNode { - const { changeToken } = useInstanceContext(); const [notif, setNotif] = useState<Notification | undefined>(undefined); const { i18n } = useTranslationContext(); @@ -119,11 +118,8 @@ function CommonUpdate( d: MerchantBackend.Instances.InstanceAuthConfigurationMessage, ): Promise<void> => { const apiCall = - d.method === "external" ? clearToken() : setNewToken(d.token!); - return apiCall - .then(() => changeToken(d.token)) - .then(onConfirm) - .catch(onUpdateError); + d.method === "external" ? clearToken() : setNewToken(d.token! as AccessToken); + return apiCall.then(onConfirm).catch(onUpdateError); }} /> </Fragment> |