Skip to content

Commit ead3ae2

Browse files
authored
Merge pull request #139 from Vito0912/feat/betterlogin
Feat/betterlogin
2 parents e7daf8c + 6e75594 commit ead3ae2

36 files changed

+4049
-5135
lines changed

lib/api/routes/abs_api.dart

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,7 @@ class ABSApi {
106106
);
107107
} catch (error, stackTrace) {
108108
log("$error\n$stackTrace", name: route);
109-
throw DioException(
110-
requestOptions: RequestOptions(path: route),
111-
type: DioExceptionType.unknown,
112-
error: error,
113-
stackTrace: stackTrace,
114-
);
109+
rethrow;
115110
}
116111
}
117112

@@ -193,12 +188,7 @@ class ABSApi {
193188
log(error.response!.data.toString(), name: replacedRoute);
194189
}
195190
}
196-
throw DioException(
197-
requestOptions: RequestOptions(path: replacedRoute),
198-
type: DioExceptionType.unknown,
199-
error: error,
200-
stackTrace: stackTrace,
201-
);
191+
rethrow;
202192
}
203193
}
204194

lib/api/routes/me_api.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ class MeApi {
2929
);
3030
}
3131

32+
Future<Response<Login>> checkLogin({
33+
CancelToken? cancelToken,
34+
Map<String, dynamic>? headers,
35+
Map<String, dynamic>? extra,
36+
}) async {
37+
return ABSApi.makeApiPostRequest(
38+
route: '/api/authorize',
39+
fromJson: (data) => Login.fromJson(data),
40+
cancelToken: cancelToken,
41+
headers: headers,
42+
extra: extra,
43+
dio: _dio,
44+
bodyData: {},
45+
);
46+
}
47+
3248
Future<Response<Bookmark>> createBookmark(
3349
itemId, {
3450
required CreateBookmarkRequest createBookmarkRequest,

lib/app.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class _AbsAppState extends ConsumerState<AbsApp> with WidgetsBindingObserver {
6161
final settings = ref.watch(specificKeysSettingsProvider(
6262
[Constants.DARK_MODE, Constants.LANGUAGE, Constants.AMOLED_MODE]));
6363
final userIndex = ref.watch(selectedUserProvider);
64+
print('User Index: $userIndex');
6465
//TODO: Two calls. Unify me api calls
6566
if (userIndex >= 0) {
6667
final progressProv = ref.read(progressProvider);

0 commit comments

Comments
 (0)