diff --git a/lib/core/services/constants.dart b/lib/core/services/constants.dart index 182ce47..9866315 100644 --- a/lib/core/services/constants.dart +++ b/lib/core/services/constants.dart @@ -1,2 +1,2 @@ const String baseUrl = - 'https://ebdc-2001-448a-50a0-3463-a4de-673f-afb-724b.ngrok-free.app/'; + 'https://f7fe-2001-448a-50a0-3463-a4de-673f-afb-724b.ngrok-free.app/'; diff --git a/lib/core/services/dio_client.dart b/lib/core/services/dio_client.dart index 23c9d7d..c7422bf 100644 --- a/lib/core/services/dio_client.dart +++ b/lib/core/services/dio_client.dart @@ -15,7 +15,7 @@ class DioClient { Future refreshAccessToken(String refreshToken) async { try { final response = await _dio.post( - '/refreshToken', + '/api/refreshToken', data: {'REFRESH_TOKEN': refreshToken}, options: Options( headers: { @@ -52,7 +52,7 @@ class DioClient { String id, FormData formData, String token) async { try { final response = await _dio.put( - '/user/update/$id', + '/api/user/update/$id', data: formData, options: Options( headers: { @@ -75,7 +75,7 @@ class DioClient { ) async { try { final response = await _dio.put( - '/user/update/password/$id', + '/api/user/update/password/$id', data: data, options: Options( headers: { @@ -96,12 +96,16 @@ class DioClient { String token, ) async { try { - final response = await _dio.post('/report', - data: data, - options: Options(headers: { + final response = await _dio.post( + '/api/report', + data: data, + options: Options( + headers: { 'Authorization': 'Bearer $token', 'Content-Type': 'application/json', - })); + }, + ), + ); return response; } catch (e) { print('Update Password error: $e'); @@ -113,7 +117,7 @@ class DioClient { try { // Send POST request to the registration endpoint final response = await _dio.post( - '/register/student', + '/api/register/student', data: data, options: Options( headers: { @@ -131,7 +135,7 @@ class DioClient { Future loginStudent(Map data) async { try { final response = await _dio.post( - '/login', + '/api/login', data: data, options: Options( headers: { @@ -148,7 +152,7 @@ class DioClient { Future forgotPassword(Map data) async { try { final response = await _dio.post( - '/forgotPassword', + '/api/forgotPassword', data: data, options: Options( headers: { @@ -166,7 +170,7 @@ class DioClient { try { print('Sending getMe request with token: Bearer $token'); final response = await _dio.get( - '/getMe', + '/api/getMe', options: Options( headers: { 'Authorization': 'Bearer $token', // Add 'Bearer ' prefix here @@ -184,7 +188,7 @@ class DioClient { Future getSections(String token) async { try { final response = await _dio.get( - '/section', + '/api/section', options: Options( headers: { 'Authorization': 'Bearer $token', @@ -203,7 +207,7 @@ class DioClient { Future getTopics(String sectionId, String token) async { try { final response = await _dio.get( - '/topic/section/$sectionId', + '/api/topic/section/$sectionId', options: Options( headers: { 'Authorization': 'Bearer $token', @@ -222,7 +226,7 @@ class DioClient { Future getLevels(String topicsId, String token) async { try { final response = await _dio.get( - '/level/topic/$topicsId', + '/api/level/topic/$topicsId', options: Options( headers: { 'Authorization': 'Bearer $token', @@ -241,7 +245,7 @@ class DioClient { Future createStudentLearning(String idLevel, String token) async { try { final response = await _dio.post( - '/stdLearning', + '/api/stdLearning', data: {'ID_LEVEL': idLevel}, options: Options( headers: { @@ -260,7 +264,7 @@ class DioClient { Future getExercises(String levelId, String token) async { try { final response = await _dio.get( - '/exercise/level/$levelId', + '/api/exercise/level/$levelId', options: Options( headers: { 'Authorization': 'Bearer $token', @@ -284,7 +288,7 @@ class DioClient { List> answers, String token) async { try { final response = await _dio.post( - '/stdExercise', + '/api/stdExercise', data: {'answers': answers}, options: Options( headers: { @@ -304,7 +308,7 @@ class DioClient { Future getScore(String stdLearningId, String token) async { try { final response = await _dio.get( - '/stdLearning/score/$stdLearningId', + '/api/stdLearning/score/$stdLearningId', options: Options( headers: { 'Authorization': 'Bearer $token', @@ -328,7 +332,7 @@ class DioClient { }) async { try { final response = await _dio.get( - '/learningHistory/section/$sectionId', + '/api/learningHistory/section/$sectionId', queryParameters: { 'page': page, 'limit': limit, @@ -351,7 +355,7 @@ class DioClient { Future getCompletedTopics(String token) async { try { final response = await _dio.get( - '/topic/complete', + '/api/topic/complete', options: Options( headers: { 'Authorization': 'Bearer $token', @@ -374,7 +378,7 @@ class DioClient { ) async { try { final response = await _dio.put( - '/stdLearning/$stdLearningId', + '/api/stdLearning/$stdLearningId', data: {'FEEDBACK_STUDENT': feedback}, options: Options( headers: { @@ -393,7 +397,7 @@ class DioClient { Future getStudentAnswers(String stdLearningId, String token) async { try { final response = await _dio.get( - '/studentAnswers/$stdLearningId', + '/api/studentAnswers/$stdLearningId', options: Options( headers: { 'Authorization': 'Bearer $token', diff --git a/lib/core/services/repositories/user_repository.dart b/lib/core/services/repositories/user_repository.dart index d391222..a7b98cf 100644 --- a/lib/core/services/repositories/user_repository.dart +++ b/lib/core/services/repositories/user_repository.dart @@ -18,7 +18,7 @@ class UserRepository { } Future logoutUser() async { - return await dioClient.post('/logout'); + return await dioClient.post('/api/logout'); } Future forgotPassword(String email) async {