Siopas Inventory PETI for ISTW Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
966 B

import 'package:siopas/models/m_asset_status_model.dart';
import '../connection/connection.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'dart:async';
class M_assetStatusService {
Future<List<PetiAssetModel>> getAssetStatus() async {
var url = Uri.parse("${await getBaseUrl()}/m-status");
var headers = {'Content-Type': 'application/json'};
var response = await http.get(url, headers: headers);
print(response.body);
print("SUCCESS GET DATA Asset Status");
if (response.statusCode == 200) {
List data = jsonDecode(response.body)['data']['asset'];
List<PetiAssetModel> m_assetStatus = [];
if (data != null) {
for (var item in data) {
m_assetStatus.add(PetiAssetModel.fromJson(item));
}
}
return m_assetStatus;
} else {
throw Exception('Gagal Get Asset Status!');
}
}
}