File tree Expand file tree Collapse file tree
src/lib/features/auth/presentation/viewmodels Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,8 +95,37 @@ class LoginViewModel extends BaseViewModel {
9595 setLoading (false );
9696 }
9797 }
98+ // 1.1 LOGIN WITH GOOGLE
99+ Future <String ?> loginWithGoogle () async {
100+ setLoading (true );
101+ try {
102+ final success = await _authHelper.loginWithGoogle ();
103+ if (success) return null ; // Thành công (thường Supabase sẽ tự văng ra web browser)
104+ return 'Lỗi khi mở cổng đăng nhập Google!' ;
105+ } catch (e) {
106+ return handleError (e);
107+ } finally {
108+ setLoading (false );
109+ }
110+ }
111+
112+ // 1.2 LOGIN WITH FACEBOOK
113+
114+ Future <String ?> loginWithFacebook () async {
115+ setLoading (true );
116+ try {
117+ final success = await _authHelper.loginWithFacebook ();
118+ if (success) return null ;
119+ return 'Lỗi khi mở cổng đăng nhập Facebook!' ;
120+ } catch (e) {
121+ return handleError (e);
122+ } finally {
123+ setLoading (false );
124+ }
125+ }
98126}
99127
128+
100129// ==========================================
101130// 2. REGISTER VIEWMODEL
102131// ==========================================
You can’t perform that action at this time.
0 commit comments