-
App Token:
-
{state.accessToken}
+
+
App Token:
+
{state.accessToken}
} size="small"
onClick={() => onClipboard(state.accessToken)} />
diff --git a/net/web/src/dashboard/accountItem/useAccountItem.hook.js b/net/web/src/dashboard/accountItem/useAccountItem.hook.js
index 42e5b0b3..5bc93327 100644
--- a/net/web/src/dashboard/accountItem/useAccountItem.hook.js
+++ b/net/web/src/dashboard/accountItem/useAccountItem.hook.js
@@ -42,13 +42,14 @@ export function useAccountItem(item, remove) {
if (!state.accessBusy) {
updateState({ accessBusy: true });
try {
- let access = await addAccountAccess(app.state.adminToken, item.accountId);
- updateState({ accessToken: access, showAccess: true });
+ const access = await addAccountAccess(app.state.adminToken, item.accountId);
+ updateState({ accessToken: access, showAccess: true, accessBusy: false });
}
catch (err) {
- window.alert(err);
+ console.log(err);
+ updateState({ accessBusy: false });
+ throw new Error('failed to generate token');
}
- updateState({ accessBusy: false });
}
},
setShowAccess: (showAccess) => {
@@ -59,12 +60,13 @@ export function useAccountItem(item, remove) {
updateState({ removeBusy: true });
try {
await remove(state.accountId);
+ updateState({ removeBusy: false });
}
catch(err) {
console.log(err);
- window.alert(err);
+ updateState({ removeBusy: false });
+ throw new Error('failed to remove account');
}
- updateState({ removeBusy: false });
}
},
setStatus: async (disabled) => {
@@ -72,13 +74,13 @@ export function useAccountItem(item, remove) {
updateState({ statusBusy: true });
try {
await setAccountStatus(app.state.adminToken, item.accountId, disabled);
- updateState({ disabled, activeClass: disabled ? 'inactive' : 'active' });
+ updateState({ statusBusy: false, disabled, activeClass: disabled ? 'inactive' : 'active' });
}
catch(err) {
console.log(err);
- window.alert(err);
+ updateState({ statusBusy: false });
+ throw new Error('failed to set account status');
}
- updateState({ statusBusy: false });
}
},
};
diff --git a/net/web/src/dashboard/useDashboard.hook.js b/net/web/src/dashboard/useDashboard.hook.js
index b1038f03..15e054b5 100644
--- a/net/web/src/dashboard/useDashboard.hook.js
+++ b/net/web/src/dashboard/useDashboard.hook.js
@@ -64,7 +64,7 @@ export function useDashboard() {
},
removeAccount: async (accountId) => {
await removeAccount(app.state.adminToken, accountId);
- actions.getAccounts();
+ syncAccounts();
},
setHost: (domain) => {
updateState({ domain });