mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 21:18:56 +03:30
commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import 'package:cssd/config/urls.dart';
|
||||
import 'package:cssd/config/user.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class TestResult with ChangeNotifier{
|
||||
final int id;
|
||||
final String name;
|
||||
final String date;
|
||||
final String deviceId;
|
||||
String result;
|
||||
|
||||
bool get isVerified {
|
||||
return result == 'Verified';
|
||||
}
|
||||
|
||||
TestResult({
|
||||
this.id,
|
||||
this.name,
|
||||
this.date,
|
||||
this.deviceId,
|
||||
this.result,
|
||||
});
|
||||
|
||||
Future<void> toggleVerify() async {
|
||||
final response = await http.post(
|
||||
Url.verifyTest(id), headers: {
|
||||
'Authorization': User.token
|
||||
}
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
result = result == 'Verified' ? 'NotVerified' : 'Verified';
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user