Commit 8c93b59a authored by Fikri's avatar Fikri

menambahkan get api pada halaman dashboard contact us

parent 580c14bb
...@@ -6,6 +6,11 @@ import 'package:medapp_eksad/model/contact_model.dart'; ...@@ -6,6 +6,11 @@ import 'package:medapp_eksad/model/contact_model.dart';
var cmd = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/cmd'; var cmd = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/cmd';
var qry = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/qry'; var qry = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/qry';
Future<List<dynamic>> getcontact() async {
var response = await http.get(Uri.parse('$qry/contact/get'));
return jsonDecode(response.body)['data'];
}
Future<bool> savecontact(nama, email, nohp, message) async { Future<bool> savecontact(nama, email, nohp, message) async {
final response = await http.post( final response = await http.post(
Uri.parse('$cmd/contact/save'), Uri.parse('$cmd/contact/save'),
...@@ -25,12 +30,3 @@ Future<bool> savecontact(nama, email, nohp, message) async { ...@@ -25,12 +30,3 @@ Future<bool> savecontact(nama, email, nohp, message) async {
// return response.statusCode; // return response.statusCode;
} }
Future<List<contact>> showcontact() async {
var response = await http
.get(Uri.parse('$qry/contact/get'));
var resultJson = jsonDecode(response.body)['data'];
List<contact> contactlist = await resultJson
.map<contact>((json) => contact.fromJson(json))
.toList();
return contactlist;
}
\ No newline at end of file
This diff is collapsed.
...@@ -259,10 +259,7 @@ class _SignInState extends State<SignIn> { ...@@ -259,10 +259,7 @@ class _SignInState extends State<SignIn> {
); );
} else if (_usernamecontroller.value.text == 'admin@admin.com' && } else if (_usernamecontroller.value.text == 'admin@admin.com' &&
_passwordcontroller.value.text == 'administrator') { _passwordcontroller.value.text == 'administrator') {
Navigator.pushNamed(context, '/admin'); Navigator.pushNamed(context, '/dashboard');
} else if (_usernamecontroller.value.text == 'client@client.com' &&
_passwordcontroller.value.text == 'clientpage') {
Navigator.pushNamed(context, '/client');
} else { } else {
showDialog<String>( showDialog<String>(
context: context, context: context,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment