mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 15:17:55 +00:00
36 lines
968 B
Dart
36 lines
968 B
Dart
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_app/services/api/profile_api.dart';
|
|
|
|
part 'menu_state.dart';
|
|
|
|
class MenuCubit extends Cubit<MenuState> {
|
|
MenuCubit() : super(MenuInitial());
|
|
static MenuCubit of(context) => BlocProvider.of<MenuCubit>(context);
|
|
|
|
String name = '';
|
|
String userAgreementHtml = "";
|
|
String privacyPolicyHtml = "";
|
|
|
|
Future<void> fetchAgreement() async {
|
|
try {
|
|
emit(MenuLoading());
|
|
final response = await ProfileApi().fetchUserAgreement();
|
|
userAgreementHtml = response;
|
|
emit(MenuLoaded(userAgreementHtml));
|
|
} catch (error) {
|
|
emit(MenuError(error.toString()));
|
|
}
|
|
}
|
|
|
|
Future<void> fetchPrivacyPolicy() async {
|
|
try {
|
|
emit(MenuLoading());
|
|
final response = await ProfileApi().fetchPrivacyPolicy();
|
|
privacyPolicyHtml = response;
|
|
emit(MenuLoaded(privacyPolicyHtml));
|
|
} catch (error) {
|
|
emit(MenuError(error.toString()));
|
|
}
|
|
}
|
|
}
|