Show RS widget when Unauthorized error received
Allows the user to re-auth via the widget
This commit is contained in:
@@ -11,7 +11,7 @@ export default class UserMenuComponent extends Component {
|
||||
@action
|
||||
connectRS() {
|
||||
this.args.onClose();
|
||||
this.args.storage.connect();
|
||||
this.args.storage.showConnectWidget();
|
||||
}
|
||||
|
||||
@action
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user