Fix API endpoints to match inou backend

- /api/v1/auth/send (not /api/auth/send-code)
- /api/v1/auth/verify (not /api/auth/verify)
- Check for token in response (not success: true)
This commit is contained in:
Johan Jongsma 2026-02-01 21:11:56 +00:00
parent 56f86ccc7d
commit b4cbfa08f5
1 changed files with 6 additions and 8 deletions

View File

@ -44,7 +44,7 @@ class InouApi {
Future<String?> sendLoginCode(String email) async {
try {
final response = await http.post(
Uri.parse('$baseUrl/api/auth/send-code'),
Uri.parse('$baseUrl/api/v1/auth/send'),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
@ -80,7 +80,7 @@ class InouApi {
Future<String?> verifyCode(String email, String code) async {
try {
final response = await http.post(
Uri.parse('$baseUrl/api/auth/verify'),
Uri.parse('$baseUrl/api/v1/auth/verify'),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
@ -101,13 +101,11 @@ class InouApi {
final json = jsonDecode(response.body);
if (response.statusCode == 200 && json['success'] == true) {
// Get session token from response
_sessionToken = json['token'] ?? json['session_token'];
if (response.statusCode == 200 && json['token'] != null) {
// Success - got session token
_sessionToken = json['token'];
_dossierId = json['dossier_id'];
if (_sessionToken != null) {
await _saveSession();
}
await _saveSession();
return null; // Success
}