Sync API with flutter_lints v2.0.1

This commit is contained in:
Moe Poi ~ 2022-05-12 10:27:19 +07:00
parent d76512d7c6
commit 136cd4753e

View file

@ -2,20 +2,20 @@ import 'package:dio/dio.dart';
import 'package:nekoya_flutter/api/config.dart'; import 'package:nekoya_flutter/api/config.dart';
Future<dynamic> getProducts() async { Future<dynamic> getProducts() async {
var req = await Dio().get(host + '/getproducts'); var req = await Dio().get('$host/getproducts');
var res = req.data; var res = req.data;
return res; return res;
} }
Future<dynamic> getProduct(id) async { Future<dynamic> getProduct(id) async {
var req = await Dio().get(host + '/getproduct', queryParameters: {'id': id}); var req = await Dio().get('$host/getproduct', queryParameters: {'id': id});
var res = req.data; var res = req.data;
return res; return res;
} }
Future<dynamic> registerPost(data) async { Future<dynamic> registerPost(data) async {
Response req = await Dio().post( Response req = await Dio().post(
(host + '/register'), ('$host/register'),
data: data, data: data,
options: Options( options: Options(
contentType: Headers.formUrlEncodedContentType, contentType: Headers.formUrlEncodedContentType,
@ -29,7 +29,7 @@ Future<dynamic> registerPost(data) async {
Future<dynamic> loginPost({email, password}) async { Future<dynamic> loginPost({email, password}) async {
Response req = await Dio().post( Response req = await Dio().post(
(host + '/login'), ('$host/login'),
data: { data: {
'email': email, 'email': email,
'password': password, 'password': password,
@ -48,7 +48,7 @@ Future<dynamic> getSessions() async {
String tempKey = String tempKey =
'rTugfHPB7Cd4I1OmsbFCHuJvBSjA2C48WOcMghviohNlNj8IZqazvtwJrdGFHDwp'; 'rTugfHPB7Cd4I1OmsbFCHuJvBSjA2C48WOcMghviohNlNj8IZqazvtwJrdGFHDwp';
var req = await Dio() var req = await Dio()
.post(host + '/sessions', queryParameters: {'key': tempKey}); .post('$host/sessions', queryParameters: {'key': tempKey});
var res = req.data; var res = req.data;
return res; return res;
} }
@ -57,7 +57,7 @@ Future<dynamic> getTransactions() async {
String tempKey = String tempKey =
'rTugfHPB7Cd4I1OmsbFCHuJvBSjA2C48WOcMghviohNlNj8IZqazvtwJrdGFHDwp'; 'rTugfHPB7Cd4I1OmsbFCHuJvBSjA2C48WOcMghviohNlNj8IZqazvtwJrdGFHDwp';
var req = await Dio() var req = await Dio()
.post(host + '/transaction', queryParameters: {'key': tempKey}); .post('$host/transaction', queryParameters: {'key': tempKey});
var res = req.data; var res = req.data;
return res; return res;
} }
@ -66,7 +66,7 @@ Future<dynamic> checkoutPost(data) async {
String tempKey = String tempKey =
'rTugfHPB7Cd4I1OmsbFCHuJvBSjA2C48WOcMghviohNlNj8IZqazvtwJrdGFHDwp'; 'rTugfHPB7Cd4I1OmsbFCHuJvBSjA2C48WOcMghviohNlNj8IZqazvtwJrdGFHDwp';
Response req = await Dio().post( Response req = await Dio().post(
(host + '/checkout'), ('$host/checkout'),
queryParameters: {'key': tempKey}, queryParameters: {'key': tempKey},
data: data, data: data,
options: Options( options: Options(