import 'package:app_gaslieferung/exceptions/login.dart';
import 'package:app_links/app_links.dart';

String getSessionIdFromUrl(Uri uri) {
  if (uri.scheme == 'myapp' && uri.host == 'callback') {
    final code = uri.queryParameters['session_id'];
    if (code != null) {
      return code;
    } else {
      throw LoginNoSessionIdException();
    }
  }

  throw LoginInvalidUrlException();
}
