creazione nuovo negozio
This commit is contained in:
@@ -48,7 +48,7 @@ class _CreateCompanyScreenState extends State<CreateCompanyScreen> {
|
||||
void _onSave() {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// Recuperiamo l'ID utente attuale da Supabase o dal SessionBloc
|
||||
final userId = GetIt.I.get<AppSettings>().currentUserId!;
|
||||
final userId = context.read<SessionBloc>().state.userId!;
|
||||
|
||||
final company = CompanyModel(
|
||||
userId: userId,
|
||||
@@ -91,7 +91,7 @@ class _CreateCompanyScreenState extends State<CreateCompanyScreen> {
|
||||
listener: (context, state) {
|
||||
if (state.status == CompanyStatus.success && state.company != null) {
|
||||
// 1. Aggiorniamo la singleton con i dati reali (ID incluso)
|
||||
GetIt.I.get<AppSettings>().setCurrentCompany(state.company);
|
||||
//GetIt.I.get<AppSettings>().setCurrentCompany(state.company);
|
||||
|
||||
// 2. Notifichiamo il SessionBloc per cambiare pagina
|
||||
context.read<SessionBloc>().add(AppStarted());
|
||||
|
||||
Reference in New Issue
Block a user