diff --git a/web/repertory/lib/models/mount.dart b/web/repertory/lib/models/mount.dart index 349b213e..5abce292 100644 --- a/web/repertory/lib/models/mount.dart +++ b/web/repertory/lib/models/mount.dart @@ -101,6 +101,35 @@ class Mount with ChangeNotifier { } } + Future clearMountLocation() async { + try { + mountConfig.path = ""; + + final auth = await _auth.createAuth(); + final response = await http.delete( + Uri.parse( + Uri.encodeFull( + '${getBaseUri()}/api/v1/mount_location?auth=$auth&name=$name&type=$type', + ), + ), + ); + + if (response.statusCode == 401) { + _auth.logoff(); + return; + } + + if (response.statusCode == 404) { + _mountList?.reset(); + return; + } + + return refresh(); + } catch (e) { + debugPrint('$e'); + } + } + Future> getAvailableLocations() async { try { final auth = await _auth.createAuth(); @@ -253,33 +282,4 @@ class Mount with ChangeNotifier { debugPrint('$e'); } } - - Future clearPath() async { - try { - mountConfig.path = ""; - - final auth = await _auth.createAuth(); - final response = await http.delete( - Uri.parse( - Uri.encodeFull( - '${getBaseUri()}/api/v1/mount_location?auth=$auth&name=$name&type=$type', - ), - ), - ); - - if (response.statusCode == 401) { - _auth.logoff(); - return; - } - - if (response.statusCode == 404) { - _mountList?.reset(); - return; - } - - return refresh(); - } catch (e) { - debugPrint('$e'); - } - } } diff --git a/web/repertory/lib/widgets/mount_widget.dart b/web/repertory/lib/widgets/mount_widget.dart index 608f2e24..9495f5bf 100644 --- a/web/repertory/lib/widgets/mount_widget.dart +++ b/web/repertory/lib/widgets/mount_widget.dart @@ -66,7 +66,7 @@ class _MountWidgetState extends State { if (mount.mounted != null && !mount.mounted!) IconButton( icon: Icon(Icons.clear), - onPressed: () => mount.clearPath(), + onPressed: () => mount.clearMountLocation(), ), IconButton( icon: Icon(