mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 15:07:54 +00:00
Add HomeCubit and HomeState classes
This commit adds the HomeCubit class along with its corresponding HomeState class. It also includes necessary imports and updates references to the previously used SpacesCubit to the new HomeCubit in various files. handled the multible onCreate -- HomeCubit
This commit is contained in:
@@ -3,7 +3,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:syncrow_app/features/app_layout/bloc/spaces_cubit.dart';
|
||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||
|
||||
import 'package:syncrow_app/features/auth/model/login_with_email_model.dart';
|
||||
import 'package:syncrow_app/features/auth/model/token.dart';
|
||||
@@ -42,8 +42,6 @@ class AuthCubit extends Cubit<AuthState> {
|
||||
|
||||
static Token token = Token.emptyConstructor();
|
||||
|
||||
// (FlutterSecureStorage().read(key :'token'));
|
||||
|
||||
login() async {
|
||||
emit(AuthLoading());
|
||||
try {
|
||||
@@ -76,7 +74,7 @@ class AuthCubit extends Cubit<AuthState> {
|
||||
try {
|
||||
FlutterSecureStorage storage = const FlutterSecureStorage();
|
||||
await storage.delete(key: Token.loginAccessTokenKey);
|
||||
SpacesCubit.clear();
|
||||
HomeCubit.clear();
|
||||
emit(AuthLoggedOut());
|
||||
} on DioException catch (e) {
|
||||
emit(AuthError(ServerFailure.fromDioError(e).errMessage));
|
||||
|
||||
Reference in New Issue
Block a user