import 'dart:convert';

import 'package:flutter/cupertino.dart';
import 'package:hl_lieferservice/feature/authentication/model/user.dart';
import 'package:http/http.dart';

class UserInfoService {
  String url;

  UserInfoService({ required this.url });

  Future<User> getUserinfo(String sessionId) async {
    var headers = {
      "Cookie": "session_id=$sessionId"
    };

    var result = await get(Uri.parse("$url/userinfo"), headers: headers);
    debugPrint("USERINFO: ${result.body}");
    return User.fromJson(jsonDecode(result.body));
  }
}