Commit ad68ee64 authored by qorri_di's avatar qorri_di

user api

-setting signIn
-setting signOut
-setting signUp
-setting resetPassword
-setting get_user
parent d607485f
...@@ -3,9 +3,12 @@ import 'dart:convert'; ...@@ -3,9 +3,12 @@ import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:medapp_eksad/model/contact_model.dart'; import 'package:medapp_eksad/model/contact_model.dart';
var cmd = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/cmd';
var qry = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/qry';
Future savecontact(nama, email, nohp, message) async { Future savecontact(nama, email, nohp, message) async {
final response = await http.post( final response = await http.post(
Uri.parse('http://10.107.223.156:8081/medapp/v1/api/contact/save'), Uri.parse('$cmd/contact/save'),
body: jsonEncode({ body: jsonEncode({
"nama": nama, "nama": nama,
"email": email, "email": email,
...@@ -24,7 +27,7 @@ Future savecontact(nama, email, nohp, message) async { ...@@ -24,7 +27,7 @@ Future savecontact(nama, email, nohp, message) async {
Future<List<contact>> showcontact() async { Future<List<contact>> showcontact() async {
var response = await http var response = await http
.get(Uri.parse('http://10.107.223.156:8082/medapp/v1/api/contact/get')); .get(Uri.parse('$qry/contact/get'));
var resultJson = jsonDecode(response.body)['data']; var resultJson = jsonDecode(response.body)['data'];
List<contact> contactlist = await resultJson List<contact> contactlist = await resultJson
.map<contact>((json) => contact.fromJson(json)) .map<contact>((json) => contact.fromJson(json))
......
...@@ -3,9 +3,12 @@ import 'dart:convert'; ...@@ -3,9 +3,12 @@ import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:medapp_eksad/model/user_model.dart'; import 'package:medapp_eksad/model/user_model.dart';
var cmd = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/cmd';
var qry = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/qry';
Future<bool> signUp(nama, email, nohp, username, password)async{ Future<bool> signUp(nama, email, nohp, username, password)async{
final response = await http.post( final response = await http.post(
Uri.parse('http://10.107.203.242:8081/medapp/v1/api/user/signup'), Uri.parse('$cmd/user/signup'),
body: jsonEncode({ body: jsonEncode({
"namaUser": nama, "namaUser": nama,
"emailUser": email, "emailUser": email,
...@@ -25,7 +28,7 @@ Future<bool> signUp(nama, email, nohp, username, password)async{ ...@@ -25,7 +28,7 @@ Future<bool> signUp(nama, email, nohp, username, password)async{
} }
Future<bool> signIn(username, password)async{ Future<bool> signIn(username, password)async{
final response = await http.post( final response = await http.post(
Uri.parse('http://10.3.4.250:8081/medapp/v1/api/user/signin'), Uri.parse('$cmd/user/signin'),
body: jsonEncode({ body: jsonEncode({
"username": username, "username": username,
"password": password}), "password": password}),
...@@ -42,7 +45,7 @@ Future<bool> signIn(username, password)async{ ...@@ -42,7 +45,7 @@ Future<bool> signIn(username, password)async{
} }
Future<bool> signOut(username)async{ Future<bool> signOut(username)async{
final response = await http.post( final response = await http.post(
Uri.parse('http://10.3.4.250:8081/medapp/v1/api/user/signout'), Uri.parse('$cmd/user/signout'),
body: jsonEncode({ body: jsonEncode({
"username": username}), "username": username}),
headers: { headers: {
...@@ -58,7 +61,7 @@ Future<bool> signOut(username)async{ ...@@ -58,7 +61,7 @@ Future<bool> signOut(username)async{
} }
Future<bool> resetPassword(username, password, verifypass)async{ Future<bool> resetPassword(username, password, verifypass)async{
final response = await http.put( final response = await http.put(
Uri.parse('http://10.3.4.250:8081/medapp/v1/api/user/resetPassword'), Uri.parse('$cmd/user/resetPassword'),
body: jsonEncode({ body: jsonEncode({
"username": username, "username": username,
"password": password, "password": password,
...@@ -77,7 +80,7 @@ Future<bool> resetPassword(username, password, verifypass)async{ ...@@ -77,7 +80,7 @@ Future<bool> resetPassword(username, password, verifypass)async{
} }
Future<List<dynamic>> getUser() async { Future<List<dynamic>> getUser() async {
var response = await http var response = await http
.get(Uri.parse('http://10.3.4.231:8082/medapp/v1/api/user/get')); .get(Uri.parse('$qry/user/get'));
var resultJson = jsonDecode(response.body)['data']; var resultJson = jsonDecode(response.body)['data'];
List<user> walist = await resultJson List<user> walist = await resultJson
.map<user>((json) => user.fromJson(json)) .map<user>((json) => user.fromJson(json))
......
...@@ -3,9 +3,12 @@ import 'dart:convert'; ...@@ -3,9 +3,12 @@ import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:medapp_eksad/model/wa_model.dart'; import 'package:medapp_eksad/model/wa_model.dart';
var cmd = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/cmd';
var qry = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/qry';
Future<bool> saveWa(nama, nohp) async { Future<bool> saveWa(nama, nohp) async {
final response = await http.post( final response = await http.post(
Uri.parse('http://10.3.4.231:8081/medapp/v1/api/whatapps/save'), Uri.parse('$cmd/whatapps/save'),
body: jsonEncode({ body: jsonEncode({
"nama": nama, "nama": nama,
"no": nohp "no": nohp
...@@ -21,7 +24,7 @@ Future<bool> saveWa(nama, nohp) async { ...@@ -21,7 +24,7 @@ Future<bool> saveWa(nama, nohp) async {
} }
Future<List<dynamic>> getWA () async { Future<List<dynamic>> getWA () async {
var response = await http var response = await http
.get(Uri.parse('http://10.3.4.231:8082/medapp/v1/api/whatapps/get')); .get(Uri.parse('$qry/whatapps/get'));
var resultJson = jsonDecode(response.body)['data']; var resultJson = jsonDecode(response.body)['data'];
List<wa> walist = await resultJson List<wa> walist = await resultJson
.map<wa>((json) => wa.fromJson(json)) .map<wa>((json) => wa.fromJson(json))
......
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