feat: added authentification and redirection

This commit is contained in:
Alzalia 2025-08-08 01:03:48 +02:00
parent 1c9c5ce5fe
commit ef641d4023
24 changed files with 731 additions and 173 deletions

View file

@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import 'package:seshat/data/repositories/auth_repository.dart';
import 'package:seshat/utils/command.dart';
import 'package:seshat/utils/result.dart';
class LoginViewModel extends ChangeNotifier {
LoginViewModel({required AuthRepository authRepository})
: _authRepository = authRepository {
login = Command1<void, (String username, String password)>(_login);
}
final AuthRepository _authRepository;
late Command1 login;
Future<Result<void>> _login((String, String) credentials) async {
final (username, password) = credentials;
final result = await _authRepository.login(username, password);
if (result is Error<void>) {
debugPrint("Hehe no");
}
return result;
}
}