45 lines
1.2 KiB
Dart
45 lines
1.2 KiB
Dart
import 'package:gsp_app/api/network_api.dart';
|
|
import 'package:gsp_app/modals/QuizModel.dart';
|
|
import 'package:gsp_app/repository/endpoints.dart';
|
|
import 'package:gsp_app/views/pages/quiz/quiz_home.dart';
|
|
|
|
import '../api/base_manager.dart';
|
|
|
|
QuizeModel? quizData;
|
|
|
|
class QuizeApis {
|
|
Future<ResponseData<dynamic>> storePoints(updata) async {
|
|
final response =
|
|
await NetworkApi().postApi(url: Endpoints.storePoints, data: updata);
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
showQuizbool = false;
|
|
}
|
|
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getQuiz() async {
|
|
final response = await NetworkApi().getApi(Endpoints.getquiz);
|
|
quizData = QuizeModel.fromJson(response.data);
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> showQuiz() async {
|
|
final response = await NetworkApi().getApi(Endpoints.showQuiz);
|
|
List? quizResultlist = response.data['result'];
|
|
if (quizResultlist != null && quizResultlist.isEmpty) {
|
|
|
|
showQuizbool = true;
|
|
} else {
|
|
String isactive = response.data['result'].first['is_active'];
|
|
if (isactive == "1") {
|
|
showQuizbool = false;
|
|
} else {
|
|
showQuizbool = true;
|
|
}
|
|
}
|
|
|
|
return response;
|
|
}
|
|
}
|