first commit
This commit is contained in:
38
lib/controller/admin/dashboard_controller.dart
Normal file
38
lib/controller/admin/dashboard_controller.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sefer_admin1/constant/links.dart';
|
||||
import 'package:sefer_admin1/controller/functions/crud.dart';
|
||||
|
||||
import '../../constant/api_key.dart';
|
||||
|
||||
class DashboardController extends GetxController {
|
||||
bool isLoading = false;
|
||||
List dashbord = [];
|
||||
int creditSMS = 0;
|
||||
Future getDashBoard() async {
|
||||
isLoading = true;
|
||||
update();
|
||||
var res = await CRUD().get(link: AppLink.getdashbord, payload: {});
|
||||
if (res != 'failure') {
|
||||
var d = jsonDecode(res);
|
||||
dashbord = d['message'];
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
var res2 = await CRUD().kazumiSMS(
|
||||
link: 'https://sms.kazumi.me/api/sms/check-credit',
|
||||
payload: {"username": "Sefer", "password": AK.smsPasswordEgypt},
|
||||
);
|
||||
|
||||
creditSMS = res2['credit'];
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getDashBoard();
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user