menyambungkan api vercel
This commit is contained in:
parent
15ecb33072
commit
9cc9a17015
|
@ -7,15 +7,15 @@ import 'package:image_picker/image_picker.dart';
|
|||
import 'package:http_parser/http_parser.dart';
|
||||
|
||||
class ApiService {
|
||||
static const String baseUrl = 'http://localhost:5000/api/auth';
|
||||
static const String gejalaUrl = 'http://localhost:5000/api/gejala';
|
||||
static const String hamaUrl = 'http://localhost:5000/api/hama';
|
||||
static const String penyakitUrl = 'http://localhost:5000/api/penyakit';
|
||||
static const String rulesPenyakitUrl ='http://localhost:5000/api/rules_penyakit';
|
||||
static const String rulesHamaUrl = 'http://localhost:5000/api/rules_hama';
|
||||
static const String userUrl = 'http://localhost:5000/api/users';
|
||||
static const String diagnosaUrl = 'http://localhost:5000/api/diagnosa';
|
||||
static const String historiUrl = 'http://localhost:5000/api/histori';
|
||||
static const String baseUrl = 'https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/auth';
|
||||
static const String gejalaUrl = 'https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/gejala';
|
||||
static const String hamaUrl = 'https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/hama';
|
||||
static const String penyakitUrl = 'https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/penyakit';
|
||||
static const String rulesPenyakitUrl ='https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/rules_penyakit';
|
||||
static const String rulesHamaUrl = 'https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/rules_hama';
|
||||
static const String userUrl = 'https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/users';
|
||||
static const String diagnosaUrl = 'https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/diagnosa';
|
||||
static const String historiUrl = 'https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/histori';
|
||||
static const Duration timeout = Duration(seconds: 15);
|
||||
|
||||
/// Fungsi untuk mengirim gejala dan menerima hasil diagnosa
|
||||
|
@ -419,7 +419,7 @@ Future<List<Map<String, dynamic>>> getAllHistori() async {
|
|||
|
||||
Future<Uint8List?> getHamaImageBytesByFilename(String filename) async {
|
||||
try {
|
||||
final url = Uri.parse('http://localhost:5000/image_hama/$filename');
|
||||
final url = Uri.parse('https://backend-sistem-pakar-diagnosa-penya.vercel.app/image_hama/$filename');
|
||||
print('Fetching image from: $url');
|
||||
final response = await http.get(url);
|
||||
|
||||
|
@ -721,7 +721,7 @@ Future<List<Map<String, dynamic>>> getAllHistori() async {
|
|||
|
||||
Future<Uint8List?> getPenyakitImageBytesByFilename(String filename) async {
|
||||
try {
|
||||
final url = Uri.parse('http://localhost:5000/image_penyakit/$filename');
|
||||
final url = Uri.parse('https://backend-sistem-pakar-diagnosa-penya.vercel.app/image_penyakit/$filename');
|
||||
print('Fetching image from: $url');
|
||||
final response = await http.get(url);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||
}
|
||||
|
||||
try {
|
||||
var url = Uri.parse("http://localhost:5000/api/auth/login");
|
||||
var url = Uri.parse("https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/auth/login");
|
||||
var response = await http.post(
|
||||
url,
|
||||
headers: {"Content-Type": "application/json"},
|
||||
|
|
|
@ -63,7 +63,7 @@ class _ProfilPageState extends State<ProfilPage> {
|
|||
}
|
||||
|
||||
// Buat URL untuk endpoint user API
|
||||
var url = Uri.parse("http://localhost:5000/api/users");
|
||||
var url = Uri.parse("https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/users");
|
||||
|
||||
// Kirim permintaan GET dengan token autentikasi
|
||||
var response = await http.get(
|
||||
|
|
|
@ -94,7 +94,7 @@ class _RiwayatDiagnosaPageState extends State<RiwayatDiagnosaPage> {
|
|||
Future<void> _fetchUserData() async {
|
||||
try {
|
||||
// Buat URL untuk endpoint user API
|
||||
var url = Uri.parse("http://localhost:5000/api/users");
|
||||
var url = Uri.parse("https://backend-sistem-pakar-diagnosa-penya.vercel.app/api/users");
|
||||
|
||||
// Kirim permintaan GET dengan token autentikasi
|
||||
var response = await http.get(
|
||||
|
|
Loading…
Reference in New Issue