import 'package:fis_jsonrpc/rpc.dart';
import 'package:flyinsono/architecture/router/index.dart';
import 'package:flyinsono/architecture/states/states.dart';
import 'package:flyinsono/js_platform/methods.dart';
import 'package:flyinsono/managers/interfaces/user_info.dart';
import 'package:get/get.dart';

import 'base.dart';

class OpenLiveCourseHandler extends MethodHandlerBase {
  OpenLiveCourseHandler() : super(TargetMethodName.OpenLiveCoursePage);
  final manager = Get.find<IUserInfoManager>();
  @override
  Future<void> execute(List<String> args) async {
    print('args:$args');
    String token = args[1];
    Store.user.setToken(token);
    await manager.getUserInfoAsync();
    Store.user.initNotificationConfig(type: WSType.Course);
    router.to(
      RouteNames.College.LiveCourseDetail,
      parameters: {
        "courseCode": args[0],
      },
    );
  }
}
