Show RS widget when Unauthorized error received

Allows the user to re-auth via the widget
This commit is contained in:
2026-04-13 13:10:33 +04:00
parent 9cdd021cda
commit 6ba1cf31cf
2 changed files with 10 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ export default class UserMenuComponent extends Component {
@action
connectRS() {
this.args.onClose();
this.args.storage.connect();
this.args.storage.showConnectWidget();
}
@action

View File

@@ -46,6 +46,14 @@ export default class StorageService extends Service {
// console.debug('[rs] client ready');
});
this.rs.on('error', (error) => {
if (!error) return;
console.info('[rs] Error —', `${error.name}: ${error.message}`);
if (error.name === 'Unauthorized') {
this.showConnectWidget();
}
});
this.rs.on('connected', () => {
this.connected = true;
this.userAddress = this.rs.remote.userAddress;
@@ -445,7 +453,7 @@ export default class StorageService extends Service {
}
@action
connect() {
showConnectWidget() {
this.isWidgetOpen = true;
// Check if widget is already attached