login static method
Implementation
static Future<Result<dynamic>> login(
NASDeviceInfo info,
String userName,
String password,
) async {
var deviceIp = "";
if (info.port == 0) {
deviceIp = info.ipAddress;
} else {
deviceIp = "${info.ipAddress}:${info.port}";
}
var result = await post(
deviceIp: deviceIp,
apiPath: "/api/user/v1.0/login.cgi",
bodyParams: {"username": userName, "password": password},
);
if (result.isSuccess) {
NasDeviceConfig.setCurrentNasInfo(info);
final data = (result.data as Map<String, dynamic>?)?["data"];
DeviceRequestManager.resetTokenFromDeviceData(data);
}
return result;
}