Skip to content

Commit

Permalink
Merge pull request #139 from Vito0912/feat/betterlogin
Browse files Browse the repository at this point in the history
Feat/betterlogin
  • Loading branch information
Vito0912 authored Jan 26, 2025
2 parents e7daf8c + 6e75594 commit ead3ae2
Show file tree
Hide file tree
Showing 36 changed files with 4,049 additions and 5,135 deletions.
14 changes: 2 additions & 12 deletions lib/api/routes/abs_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,7 @@ class ABSApi {
);
} catch (error, stackTrace) {
log("$error\n$stackTrace", name: route);
throw DioException(
requestOptions: RequestOptions(path: route),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
rethrow;
}
}

Expand Down Expand Up @@ -193,12 +188,7 @@ class ABSApi {
log(error.response!.data.toString(), name: replacedRoute);
}
}
throw DioException(
requestOptions: RequestOptions(path: replacedRoute),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
rethrow;
}
}

Expand Down
16 changes: 16 additions & 0 deletions lib/api/routes/me_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ class MeApi {
);
}

Future<Response<Login>> checkLogin({
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
}) async {
return ABSApi.makeApiPostRequest(
route: '/api/authorize',
fromJson: (data) => Login.fromJson(data),
cancelToken: cancelToken,
headers: headers,
extra: extra,
dio: _dio,
bodyData: {},
);
}

Future<Response<Bookmark>> createBookmark(
itemId, {
required CreateBookmarkRequest createBookmarkRequest,
Expand Down
1 change: 1 addition & 0 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class _AbsAppState extends ConsumerState<AbsApp> with WidgetsBindingObserver {
final settings = ref.watch(specificKeysSettingsProvider(
[Constants.DARK_MODE, Constants.LANGUAGE, Constants.AMOLED_MODE]));
final userIndex = ref.watch(selectedUserProvider);
print('User Index: $userIndex');
//TODO: Two calls. Unify me api calls
if (userIndex >= 0) {
final progressProv = ref.read(progressProvider);
Expand Down
Loading

0 comments on commit ead3ae2

Please sign in to comment.