subs_repository.dart 722 Bytes
import 'dart:io';

import 'package:appframe/config/locator.dart';
import 'package:appframe/services/api_service.dart';
import 'package:dio/dio.dart';

class SubsRepository {
  late final ApiService _appService;

  SubsRepository() {
    _appService = getIt<ApiService>(instanceName: 'appApiService');
  }

  Future<dynamic> userGroups(String type, String userid, String classCode) async {
    try {
      Response resp = await _appService.post(
        '/api/v1/comm/subs/usergroups',
        {
          "type": type,
          "userid": userid,
          "classCode": classCode,
        },
      );
      return resp.statusCode == HttpStatus.ok ? resp.data : null;
    } on DioException {
      return null;
    }
  }
}