import 'dart:convert'; import 'package:http/http.dart' as http; class AuthService { final String baseUrl = 'http://10.0.2.2:50681/'; Future> register( String username, String password) async { final response = await http.post( Uri.parse('${baseUrl}register/'), headers: { 'Content-Type': 'application/json; charset=UTF-8', }, body: jsonEncode({ 'username': username, 'password': password, }), ); return jsonDecode(response.body); } Future> login(String username, String password) async { final response = await http.post( Uri.parse('${baseUrl}auth/token/'), headers: { 'Content-Type': 'application/json; charset=UTF-8', }, body: jsonEncode({ 'username': username, 'password': password, }), ); return jsonDecode(response.body); } Future> refreshToken(String refreshToken) async { final response = await http.post( Uri.parse('${baseUrl}token/refresh/'), headers: { 'Content-Type': 'application/json; charset=UTF-8', }, body: jsonEncode({ 'refresh': refreshToken, }), ); return jsonDecode(response.body); } }