diff --git a/lib/authentication/screens/login.dart b/lib/authentication/screens/login.dart index 64b1969..781c1a1 100644 --- a/lib/authentication/screens/login.dart +++ b/lib/authentication/screens/login.dart @@ -77,7 +77,7 @@ class _LoginPageState extends State { String password = _passwordController.text; final response = await request - .login("http://127.0.0.1:8000/auth/login/", { + .login("http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/auth/login/", { 'username': username, 'password': password, }); diff --git a/lib/authentication/screens/register.dart b/lib/authentication/screens/register.dart index a908d97..d869400 100644 --- a/lib/authentication/screens/register.dart +++ b/lib/authentication/screens/register.dart @@ -119,7 +119,7 @@ class _RegisterPageState extends State { // Untuk menyambungkan Android emulator dengan Django pada localhost, // gunakan URL http://127.0.0.1/ final response = await request.postJson( - "http://127.0.0.1:8000/auth/register/", + "http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/auth/register/", jsonEncode({ "username": username, "password1": password1, diff --git a/lib/favorite/screens/favorite_list.dart b/lib/favorite/screens/favorite_list.dart index 5c9c53d..cc37f27 100644 --- a/lib/favorite/screens/favorite_list.dart +++ b/lib/favorite/screens/favorite_list.dart @@ -33,7 +33,7 @@ class _FavoriteListPageState extends State { Future fetchFavorites(CookieRequest request) async { try { final response = - await request.get('http://127.0.0.1:8000/api/user/favorites/'); + await request.get('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/user/favorites/'); if (response != null && response is List) { setState(() { allRestaurants = response; // Simpan semua data @@ -56,7 +56,7 @@ class _FavoriteListPageState extends State { Future deleteFavorite(CookieRequest request, int rumahMakanId) async { try { final response = await request.post( - 'http://127.0.0.1:8000/api/user/favorites/$rumahMakanId/delete/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/user/favorites/$rumahMakanId/delete/', {}, // Data kosong karena parameter dikirim di URL ); if (response['message'] == 'Favorite deleted successfully') { diff --git a/lib/forum/add_forum.dart b/lib/forum/add_forum.dart index 534211c..2a05428 100644 --- a/lib/forum/add_forum.dart +++ b/lib/forum/add_forum.dart @@ -96,7 +96,7 @@ class _AddForumFormState extends State { onPressed: () async { if (_formKey.currentState!.validate()) { final response = await request.postJson( - "http://127.0.0.1:8000/create-forum-flutter/", + "http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/create-forum-flutter/", jsonEncode({ 'title': _title, 'content': _content, diff --git a/lib/forum/discussion_page.dart b/lib/forum/discussion_page.dart index 3feb94b..c9634cf 100644 --- a/lib/forum/discussion_page.dart +++ b/lib/forum/discussion_page.dart @@ -38,7 +38,7 @@ class _DiscussionPageState extends State { /// 1. Mendapatkan user.id dari endpoint Django /api/current-user/ Future _fetchCurrentUserId() async { final request = context.read(); - const url = 'http://127.0.0.1:8000/api/current-user/'; + const url = 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/current-user/'; try { final response = await request.get(url); if (response['status'] == 'success') { @@ -54,7 +54,7 @@ class _DiscussionPageState extends State { /// 2. Fungsi GET komentar dari API Future> fetchComments(String forumId) async { final response = await http.get( - Uri.parse('http://127.0.0.1:8000/api/discussion/$forumId/comments/'), + Uri.parse('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/discussion/$forumId/comments/'), ); if (response.statusCode == 200) { return commentFromJson(response.body); @@ -67,7 +67,7 @@ class _DiscussionPageState extends State { Future addComment(String content) async { final request = context.read(); final url = Uri.parse( - 'http://127.0.0.1:8000/api/discussion/${currentForum.pk}/add_comment/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/discussion/${currentForum.pk}/add_comment/', ); final response = await request.post(url.toString(), { @@ -98,7 +98,7 @@ class _DiscussionPageState extends State { Future likeComment(String commentId) async { final request = context.read(); final url = Uri.parse( - 'http://127.0.0.1:8000/api/discussion/comments/$commentId/like/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/discussion/comments/$commentId/like/', ); final response = await request.post(url.toString(), {}); @@ -122,7 +122,7 @@ class _DiscussionPageState extends State { Future deleteComment(String commentId) async { final request = context.read(); final url = Uri.parse( - 'http://127.0.0.1:8000/api/discussion/comments/$commentId/delete/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/discussion/comments/$commentId/delete/', ); final response = await request.post(url.toString(), {}); @@ -151,7 +151,7 @@ class _DiscussionPageState extends State { Future forumDelete(CookieRequest request) async { try { final response = await request.post( - 'http://127.0.0.1:8000/delete-forum-flutter/${currentForum.pk}/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/delete-forum-flutter/${currentForum.pk}/', {}, ); diff --git a/lib/forum/edit_forum.dart b/lib/forum/edit_forum.dart index bef3d62..cdb43f3 100644 --- a/lib/forum/edit_forum.dart +++ b/lib/forum/edit_forum.dart @@ -34,7 +34,7 @@ class _EditForumPageState extends State { try { final response = await request.postJson( - "http://127.0.0.1:8000/edit-forum-flutter/${widget.forum.pk}/", + "http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/edit-forum-flutter/${widget.forum.pk}/", jsonEncode({ 'title': _title, 'content': _content, diff --git a/lib/forum/forum_screen.dart b/lib/forum/forum_screen.dart index ea17310..2966a5b 100644 --- a/lib/forum/forum_screen.dart +++ b/lib/forum/forum_screen.dart @@ -55,7 +55,7 @@ class _ForumScreenState extends State try { // Replace with your actual API endpoint final response = await http.get(Uri.parse( - 'http://127.0.0.1:8000/api/forum')); + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/forum')); if (response.statusCode == 200) { // Parse the JSON data @@ -100,7 +100,7 @@ class _ForumScreenState extends State try { // Replace with your actual search API endpoint if available final response = await http.get(Uri.parse( - 'http://127.0.0.1:8000/api/search-forum/?q=$query')); // Update with your IP or use 10.0.2.2 for Android emulator + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/search-forum/?q=$query')); // Update with your IP or use 10.0.2.2 for Android emulator if (response.statusCode == 200) { List forums = forumFromJson(response.body); diff --git a/lib/landing/home_screen.dart b/lib/landing/home_screen.dart index bd35e50..e890e98 100644 --- a/lib/landing/home_screen.dart +++ b/lib/landing/home_screen.dart @@ -25,7 +25,7 @@ class _HomeScreenState extends State { bool _isSuperuser = false; Future> fetchMakanan(CookieRequest request) async { - final response = await request.get('http://127.0.0.1:8000/makanan-json/'); + final response = await request.get('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/makanan-json/'); List listMakanan = []; for (var d in response) { @@ -59,7 +59,7 @@ class _HomeScreenState extends State { final request = context.read(); try { final response = await request - .post('http://127.0.0.1:8000/delete-makanan-flutter/$id/', { + .post('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/delete-makanan-flutter/$id/', { 'id': id.toString(), }); diff --git a/lib/landing/widgets/logout.dart b/lib/landing/widgets/logout.dart index cb06756..dc14188 100644 --- a/lib/landing/widgets/logout.dart +++ b/lib/landing/widgets/logout.dart @@ -17,7 +17,7 @@ class _LogoutButtonState extends State { void _logout(BuildContext context) async { final req = context.read(); - final response = await req.logout("http://127.0.0.1:8000/auth/logout/"); + final response = await req.logout("http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/auth/logout/"); String message = response["message"]; if (context.mounted) { if (response['status']) { diff --git a/lib/poll/screens/create_poll.dart b/lib/poll/screens/create_poll.dart index 99db570..ed94ffb 100644 --- a/lib/poll/screens/create_poll.dart +++ b/lib/poll/screens/create_poll.dart @@ -28,7 +28,7 @@ class _CreatePollScreenState extends State { return; } - const url = 'http://127.0.0.1:8000/polling-makanan/create/'; + const url = 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/polling-makanan/create/'; Map pollData = { 'question': _questionController.text, diff --git a/lib/poll/screens/polls_screen.dart b/lib/poll/screens/polls_screen.dart index 06d7485..42c22b4 100644 --- a/lib/poll/screens/polls_screen.dart +++ b/lib/poll/screens/polls_screen.dart @@ -21,7 +21,7 @@ class _PollsScreenState extends State { Future> fetchPolls(CookieRequest request) async { try { final response = - await request.get('http://127.0.0.1:8000/polling-makanan/polls/'); + await request.get('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/polling-makanan/polls/'); List data = response is String ? jsonDecode(response) : response; diff --git a/lib/poll/screens/result.dart b/lib/poll/screens/result.dart index 95e066e..462f56f 100644 --- a/lib/poll/screens/result.dart +++ b/lib/poll/screens/result.dart @@ -12,7 +12,7 @@ class PollResultScreen extends StatelessWidget { Future fetchPollResults(CookieRequest request, String pollId) async { try { final response = await request.get( - 'http://127.0.0.1:8000/polling-makanan/polls/$pollId/results/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/polling-makanan/polls/$pollId/results/', ); // Check if response is a String or Map and handle accordingly diff --git a/lib/poll/screens/vote.dart b/lib/poll/screens/vote.dart index af23766..bf35086 100644 --- a/lib/poll/screens/vote.dart +++ b/lib/poll/screens/vote.dart @@ -24,7 +24,7 @@ class _VoteScreenState extends State { Future fetchPollData(CookieRequest request) async { final response = await request.get( - 'http://127.0.0.1:8000/polling-makanan/vote/${widget.pollId}/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/polling-makanan/vote/${widget.pollId}/', ); if (response['status'] == 'success') { @@ -44,7 +44,7 @@ class _VoteScreenState extends State { Future submitVote(CookieRequest request, String choiceId) async { final response = await request.post( - 'http://127.0.0.1:8000/polling-makanan/vote/${widget.pollId}/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/polling-makanan/vote/${widget.pollId}/', jsonEncode({ // Encode the data as JSON 'choice': choiceId }), diff --git a/lib/poll/widgets/poll_card.dart b/lib/poll/widgets/poll_card.dart index 0e6862c..88e97bc 100644 --- a/lib/poll/widgets/poll_card.dart +++ b/lib/poll/widgets/poll_card.dart @@ -43,7 +43,7 @@ class _PollCardState extends State { try { final response = await request.post( - 'http://127.0.0.1:8000/polling-makanan/delete/${widget.pk}/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/polling-makanan/delete/${widget.pk}/', data, ); @@ -75,7 +75,7 @@ class _PollCardState extends State { Future _togglePollStatus(CookieRequest request, BuildContext context) async { try { final response = await request.post( - 'http://127.0.0.1:8000/polling-makanan/update/${widget.pk}/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/polling-makanan/update/${widget.pk}/', {}, ); diff --git a/lib/rating/screens/rating_form.dart b/lib/rating/screens/rating_form.dart index fa2f219..534a467 100644 --- a/lib/rating/screens/rating_form.dart +++ b/lib/rating/screens/rating_form.dart @@ -68,7 +68,7 @@ class _RatingFormState extends State { onPressed: () async { if (_rating > 0 && _reviewController.text.isNotEmpty) { final response = await request.postJson( - "http://127.0.0.1:8000/api/rating-toko/add-flutter/", + "http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/rating-toko/add-flutter/", jsonEncode({ 'rating': _rating, 'review': _reviewController.text, diff --git a/lib/rating/screens/rating_update.dart b/lib/rating/screens/rating_update.dart index caa6873..a84e617 100644 --- a/lib/rating/screens/rating_update.dart +++ b/lib/rating/screens/rating_update.dart @@ -85,7 +85,7 @@ class _RatingUpdateState extends State { onPressed: () async { if (_rating > 0 && _reviewController.text.isNotEmpty) { final response = await request.postJson( - "http://127.0.0.1:8000/api/rating-toko/update-flutter/", + "http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/rating-toko/update-flutter/", jsonEncode({ 'rating': _rating, 'review': _reviewController.text, diff --git a/lib/rating/screens/rating_view.dart b/lib/rating/screens/rating_view.dart index a5903f0..2a67a50 100644 --- a/lib/rating/screens/rating_view.dart +++ b/lib/rating/screens/rating_view.dart @@ -38,7 +38,7 @@ class _RatingPageState extends State { Future _fetchRumahMakan(int id) async { final resp = - await http.get(Uri.parse('http://127.0.0.1:8000/api/toko/$id/')); + await http.get(Uri.parse('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/toko/$id/')); if (resp.statusCode == 200) { final List data = jsonDecode(resp.body); return RumahMakan.fromJson(data[0]); @@ -50,7 +50,7 @@ class _RatingPageState extends State { Future> _fetchRatingsWithUsers(int id) async { // 1. Fetch all ratings for this Rumah Makan final resp = - await http.get(Uri.parse('http://127.0.0.1:8000/api/rating-toko/$id/')); + await http.get(Uri.parse('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/rating-toko/$id/')); if (resp.statusCode != 200) { throw Exception('Failed to load Ratings'); } @@ -60,7 +60,7 @@ class _RatingPageState extends State { final List combined = []; for (final rating in ratingsList) { final userRes = await http.get( - Uri.parse('http://127.0.0.1:8000/api/user/${rating.fields.user}/')); + Uri.parse('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/user/${rating.fields.user}/')); if (userRes.statusCode == 200) { final List userData = jsonDecode(userRes.body); final userName = userData[0]["fields"]["username"] ?? "Unknown"; diff --git a/lib/rating/screens/rumahmakan_view.dart b/lib/rating/screens/rumahmakan_view.dart index ce759a3..da68a91 100644 --- a/lib/rating/screens/rumahmakan_view.dart +++ b/lib/rating/screens/rumahmakan_view.dart @@ -24,7 +24,7 @@ class _TokoPageState extends State { // Function to fetch data from the API Future> fetchRumahMakanData() async { - final url = Uri.parse('http://127.0.0.1:8000/api/toko/'); + final url = Uri.parse('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/toko/'); final response = await http.get(url); if (response.statusCode == 200) { diff --git a/lib/rating/widgets/rating_card.dart b/lib/rating/widgets/rating_card.dart index 2443798..811a1e2 100644 --- a/lib/rating/widgets/rating_card.dart +++ b/lib/rating/widgets/rating_card.dart @@ -131,7 +131,7 @@ class RatingCard extends StatelessWidget { if (shouldDelete == true) { final response = await request.postJson( - "http://127.0.0.1:8000/api/rating-toko/delete-flutter/", + "http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/rating-toko/delete-flutter/", jsonEncode({ 'id_rating': idRating, 'id_rumah_makan': idRumahMakan, diff --git a/lib/store/screens/detail_makanan.dart b/lib/store/screens/detail_makanan.dart index 87f83a2..1535d17 100644 --- a/lib/store/screens/detail_makanan.dart +++ b/lib/store/screens/detail_makanan.dart @@ -29,7 +29,7 @@ class _DetailRumahMakanState extends State { } Future> fetchDetail(CookieRequest req, int id) async { - final response = await req.get('http://127.0.0.1:8000/detail-json/$id/'); + final response = await req.get('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/detail-json/$id/'); return response; } @@ -50,7 +50,7 @@ class _DetailRumahMakanState extends State { final request = context.read(); try { final response = await request - .post('http://127.0.0.1:8000/delete-rumahmakan-flutter/$id/', { + .post('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/delete-rumahmakan-flutter/$id/', { 'id': id.toString(), }); @@ -332,7 +332,7 @@ class _DetailRumahMakanState extends State { } else { // Tambah ke favorit final response = await request.post( - 'http://127.0.0.1:8000/api/user/favorites/add/$rumahMakanId/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/user/favorites/add/$rumahMakanId/', {}, ); if (response['status'] == 'success') { @@ -464,7 +464,7 @@ class _DetailRumahMakanState extends State { Future checkIfFavorite(CookieRequest request, int rumahMakanId) async { try { final response = - await request.get('http://127.0.0.1:8000/api/user/favorites/'); + await request.get('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/user/favorites/'); if (response != null && response is List) { setState(() { // Cek apakah rumah_makan.id ada di daftar favorit @@ -487,7 +487,7 @@ class _DetailRumahMakanState extends State { Future toggleFavorite(CookieRequest request, int id) async { try { final response = await request.post( - 'http://127.0.0.1:8000/api/user/favorites/add/$id/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/user/favorites/add/$id/', {}, ); if (response['status'] == 'success') { @@ -524,7 +524,7 @@ class _DetailRumahMakanState extends State { Future deleteFavorite(CookieRequest request, int favoriteId) async { try { final response = await request.post( - 'http://127.0.0.1:8000/api/user/favorites/$favoriteId/delete/', + 'http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/api/user/favorites/$favoriteId/delete/', {}, // Body kosong karena parameter dikirim di URL ); if (response['message'] == 'Favorite deleted successfully') { @@ -553,7 +553,7 @@ class _DetailRumahMakanState extends State { Future fetchDetailAndCheckFavorite(CookieRequest request) async { try { final response = - await request.get('http://127.0.0.1:8000/detail-json/${widget.id}/'); + await request.get('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/detail-json/${widget.id}/'); final rumahMakanId = response['rumah_makan'] ['id']; // Ambil rumah_makan.id dari respons detail diff --git a/lib/store/screens/edit_makanan.dart b/lib/store/screens/edit_makanan.dart index c16a361..2475916 100644 --- a/lib/store/screens/edit_makanan.dart +++ b/lib/store/screens/edit_makanan.dart @@ -40,7 +40,7 @@ class _EditMakananPageState extends State { Future _loadMakananDetail(CookieRequest req, int id) async { try { - final response = await req.get('http://127.0.0.1:8000/get-detail-makanan/$id/'); + final response = await req.get('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/get-detail-makanan/$id/'); setState(() { _namaController.text = response['name']; _hargaController.text = response['price'].toString(); @@ -58,7 +58,7 @@ class _EditMakananPageState extends State { Future> fetchListRumahMakan(CookieRequest req) async { try { - final response = await req.get('http://127.0.0.1:8000/list-rumahmakan/'); + final response = await req.get('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/list-rumahmakan/'); return response as List; } catch (e) { throw Exception("Error fetching rumah makan: $e"); @@ -207,7 +207,7 @@ class _EditMakananPageState extends State { return; } final response = await request.postJson( - "http://127.0.0.1:8000/edit-detail-makanan/${widget.id}/", + "http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/edit-detail-makanan/${widget.id}/", jsonEncode({ "name": _namaController.text, "price": int.parse(_hargaController.text), diff --git a/lib/store/screens/edit_rumahmakan.dart b/lib/store/screens/edit_rumahmakan.dart index fe7b75f..5217eca 100644 --- a/lib/store/screens/edit_rumahmakan.dart +++ b/lib/store/screens/edit_rumahmakan.dart @@ -35,7 +35,7 @@ class _EditRumahMakanPageState extends State { Future _loadRumahMakanDetail(CookieRequest req, int id) async { try { - final response = await req.get('http://127.0.0.1:8000/get-detail-rumahmakan/$id/'); + final response = await req.get('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/get-detail-rumahmakan/$id/'); setState(() { _kodeProvController.text = response['kode_provinsi'].toString(); _namaProvController.text = response['nama_provinsi']; @@ -307,7 +307,7 @@ class _EditRumahMakanPageState extends State { return; } final response = await request.postJson( - "http://127.0.0.1:8000/edit-detail-rumahmakan/${widget.id}/", + "http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/edit-detail-rumahmakan/${widget.id}/", jsonEncode({ 'kode_provinsi': _kodeProvController.text, 'nama_provinsi': _namaProvController.text, diff --git a/lib/store/screens/makanan_form.dart b/lib/store/screens/makanan_form.dart index cabe852..0248f1c 100644 --- a/lib/store/screens/makanan_form.dart +++ b/lib/store/screens/makanan_form.dart @@ -35,7 +35,7 @@ class _MakananFormPageState extends State { Future> fetchListRumahMakan(CookieRequest req) async { try { - final response = await req.get('http://127.0.0.1:8000/list-rumahmakan/'); + final response = await req.get('http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/list-rumahmakan/'); return response as List; } catch (e) { throw Exception("Error fetching rumah makan: $e"); @@ -188,7 +188,7 @@ class _MakananFormPageState extends State { return; } final response = await request.postJson( - "http://127.0.0.1:8000/add-makanan-flutter/", + "http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/add-makanan-flutter/", jsonEncode({ "name": _nama, "price": _harga, diff --git a/lib/store/screens/rumahmakan_form.dart b/lib/store/screens/rumahmakan_form.dart index 33e91d8..020d086 100644 --- a/lib/store/screens/rumahmakan_form.dart +++ b/lib/store/screens/rumahmakan_form.dart @@ -280,7 +280,7 @@ class _RumahMakanFormPageState extends State { return; } final response = await request.postJson( - "http://127.0.0.1:8000/add-rumahmakan/", + "http://daffa-abhipraya-ngandung.pbp.cs.ui.ac.id/add-rumahmakan/", jsonEncode({ "kode_provinsi": _kodeProv, "nama_provinsi": _namaProv,