This commit is contained in:
parent
aad26b8529
commit
c05b4f6652
@ -623,17 +623,22 @@ class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|||||||
widget.settings,
|
widget.settings,
|
||||||
);
|
);
|
||||||
if (settings.isNotEmpty) {
|
if (settings.isNotEmpty) {
|
||||||
final authProvider = Provider.of<Auth>(context, listen: false);
|
final mount = widget.mount;
|
||||||
convertAllToString(settings, authProvider.key).then((map) {
|
final key =
|
||||||
|
Provider.of<Auth>(
|
||||||
|
constants.navigatorKey.currentContext!,
|
||||||
|
listen: false,
|
||||||
|
).key;
|
||||||
|
convertAllToString(settings, key).then((map) {
|
||||||
map.forEach((key, value) {
|
map.forEach((key, value) {
|
||||||
if (value is Map<String, dynamic>) {
|
if (value is Map<String, dynamic>) {
|
||||||
value.forEach((subKey, subValue) {
|
value.forEach((subKey, subValue) {
|
||||||
widget.mount.setValue('$key.$subKey', subValue);
|
mount.setValue('$key.$subKey', subValue);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.mount.setValue(key, value);
|
mount.setValue(key, value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import 'dart:convert' show jsonEncode;
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:repertory/constants.dart' as constants;
|
||||||
import 'package:repertory/helpers.dart'
|
import 'package:repertory/helpers.dart'
|
||||||
show
|
show
|
||||||
convertAllToString,
|
convertAllToString,
|
||||||
@ -105,11 +106,23 @@ class _UISettingsWidgetState extends State<UISettingsWidget> {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
final settings = getChanged(widget.origSettings, widget.settings);
|
final settings = getChanged(widget.origSettings, widget.settings);
|
||||||
if (settings.isNotEmpty) {
|
if (settings.isNotEmpty) {
|
||||||
final authProvider = Provider.of<Auth>(context, listen: false);
|
debugPrint("start");
|
||||||
convertAllToString(settings, authProvider.key)
|
final key =
|
||||||
|
Provider.of<Auth>(
|
||||||
|
constants.navigatorKey.currentContext!,
|
||||||
|
listen: false,
|
||||||
|
).key;
|
||||||
|
convertAllToString(settings, key)
|
||||||
.then((map) async {
|
.then((map) async {
|
||||||
|
debugPrint("map");
|
||||||
try {
|
try {
|
||||||
|
final authProvider = Provider.of<Auth>(
|
||||||
|
constants.navigatorKey.currentContext!,
|
||||||
|
listen: false,
|
||||||
|
);
|
||||||
final auth = await authProvider.createAuth();
|
final auth = await authProvider.createAuth();
|
||||||
|
|
||||||
|
debugPrint("auth");
|
||||||
final response = await http.put(
|
final response = await http.put(
|
||||||
Uri.parse(
|
Uri.parse(
|
||||||
Uri.encodeFull(
|
Uri.encodeFull(
|
||||||
@ -121,7 +134,6 @@ class _UISettingsWidgetState extends State<UISettingsWidget> {
|
|||||||
if (response.statusCode == 401) {
|
if (response.statusCode == 401) {
|
||||||
displayAuthError();
|
displayAuthError();
|
||||||
authProvider.logoff();
|
authProvider.logoff();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('$e');
|
debugPrint('$e');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user