refactor power
This commit is contained in:
37
lib/core/blocs/session/session_state.dart
Normal file
37
lib/core/blocs/session/session_state.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
part of 'session_bloc.dart';
|
||||
|
||||
enum SessionStatus {
|
||||
unknown,
|
||||
unauthenticated,
|
||||
authenticatedNoCompany, // Loggato ma deve creare l'azienda
|
||||
authenticatedNoStore, // Ha l'azienda ma deve creare/scegliere il primo negozio
|
||||
ready,
|
||||
}
|
||||
|
||||
class SessionState extends Equatable {
|
||||
final SessionStatus status;
|
||||
final String? userId;
|
||||
final String? companyId;
|
||||
|
||||
const SessionState._({
|
||||
this.status = SessionStatus.unknown,
|
||||
this.userId,
|
||||
this.companyId,
|
||||
});
|
||||
const SessionState.unknown() : this._();
|
||||
const SessionState.unauthenticated()
|
||||
: this._(status: SessionStatus.unauthenticated);
|
||||
const SessionState.authenticatedNoCompany(String userId)
|
||||
: this._(status: SessionStatus.authenticatedNoCompany, userId: userId);
|
||||
const SessionState.authenticatedNoStore(String userId, String companyId)
|
||||
: this._(
|
||||
status: SessionStatus.authenticatedNoStore,
|
||||
userId: userId,
|
||||
companyId: companyId,
|
||||
);
|
||||
const SessionState.ready(String userId)
|
||||
: this._(status: SessionStatus.ready, userId: userId);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [status, userId];
|
||||
}
|
||||
Reference in New Issue
Block a user