v1.0.23
This commit is contained in:
parent
953753196b
commit
9311a888bc
6
.vscode/launch.json
vendored
6
.vscode/launch.json
vendored
@ -9,7 +9,11 @@
|
|||||||
"program": "lib/example/lib/main.dart",
|
"program": "lib/example/lib/main.dart",
|
||||||
"args": [
|
"args": [
|
||||||
"-d",
|
"-d",
|
||||||
"chrome"
|
"chrome",
|
||||||
|
"--web-renderer",
|
||||||
|
"html",
|
||||||
|
"--web-port",
|
||||||
|
"48102",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
Workout Test and Diet 4 You Common Util Functions
|
Workout Test and Diet 4 You Common Util Functions
|
||||||
|
|
||||||
|
### Version 1.0.23
|
||||||
|
|
||||||
|
webapi CORS solution with the API
|
||||||
|
|
||||||
### Version 1.0.22
|
### Version 1.0.22
|
||||||
|
|
||||||
webapi CORS: only diet4you domains, plugins update
|
webapi CORS: only diet4you domains, plugins update
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
import 'package:workouttest_util/model/cache.dart';
|
import 'package:workouttest_util/model/cache.dart';
|
||||||
|
import 'package:workouttest_util/service/customer_service.dart';
|
||||||
import 'package:workouttest_util/service/openai_service.dart';
|
import 'package:workouttest_util/service/openai_service.dart';
|
||||||
|
|
||||||
void main() {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
await dotenv.load(fileName: ".env");
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,8 +17,6 @@ class MyApp extends StatefulWidget {
|
|||||||
State<MyApp> createState() => _MyAppState();
|
State<MyApp> createState() => _MyAppState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class _MyAppState extends State<MyApp> {
|
class _MyAppState extends State<MyApp> {
|
||||||
String _response = "";
|
String _response = "";
|
||||||
|
|
||||||
@ -25,20 +26,21 @@ class _MyAppState extends State<MyApp> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _fetchData() async {
|
void _fetchData() async {
|
||||||
var api = OpenAIApi();
|
//var api = OpenAIApi();
|
||||||
String response = await api.getOpenAICompletion("Who wrote the song 'yellow submarine'?");
|
//String response = await api.getOpenAICompletion("Who wrote the song 'yellow submarine'?");
|
||||||
|
await CustomerApi().getCustomer(72);
|
||||||
|
String response = "OK";
|
||||||
setState(() {
|
setState(() {
|
||||||
_response = response;
|
_response = response;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Cache().setLocalBaseUrl();
|
Cache().setLocalBaseUrl();
|
||||||
|
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text("Example"),
|
title: const Text("Example"),
|
||||||
),
|
),
|
||||||
@ -57,16 +59,12 @@ class _MyAppState extends State<MyApp> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
FloatingActionButton(
|
FloatingActionButton(
|
||||||
onPressed:() => {
|
onPressed: () => {_fetchData()},
|
||||||
_fetchData()
|
|
||||||
},
|
|
||||||
tooltip: 'Send question',
|
tooltip: 'Send question',
|
||||||
child: const Icon(Icons.ad_units),
|
child: const Icon(Icons.ad_units),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -27,7 +27,6 @@ class APIWebClient with Common, Logging {
|
|||||||
final body = jsonEncode(<String, String>{'username': email, 'password': password});
|
final body = jsonEncode(<String, String>{'username': email, 'password': password});
|
||||||
var uri = Uri.parse(url);
|
var uri = Uri.parse(url);
|
||||||
var result = await http.post(uri, body: body, headers: {
|
var result = await http.post(uri, body: body, headers: {
|
||||||
"Access-Control-Allow-Origin": 'https://*.diet4you.eu, https://*.diet4you.hu, http://localhost',
|
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": "1",
|
"Authorization": "1",
|
||||||
});
|
});
|
||||||
@ -65,10 +64,6 @@ class APIWebClient with Common, Logging {
|
|||||||
}
|
}
|
||||||
var uri = Uri.parse(url);
|
var uri = Uri.parse(url);
|
||||||
var result = await http.post(uri, body: body, headers: {
|
var result = await http.post(uri, body: body, headers: {
|
||||||
"Access-Control-Allow-Origin": 'https://*.diet4you.eu, https://*.diet4you.hu, http://localhost',
|
|
||||||
"Access-Control-Allow-Headers": "Origin,Content-Type,Authorization,locale",
|
|
||||||
"Access-Control-Allow-Credentials": 'true', // Required for cookies, authorization headers with HTTPS
|
|
||||||
"Access-Control-Allow-Methods": "POST, GET, OPTIONS",
|
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": 'Bearer $authToken',
|
"Authorization": 'Bearer $authToken',
|
||||||
});
|
});
|
||||||
@ -102,10 +97,6 @@ class APIWebClient with Common, Logging {
|
|||||||
var uri = Uri.parse(url);
|
var uri = Uri.parse(url);
|
||||||
var result = await http.get(uri, headers: {
|
var result = await http.get(uri, headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Access-Control-Allow-Origin": 'https://*.diet4you.eu, https://*.diet4you.hu, http://localhost',
|
|
||||||
"Access-Control-Allow-Headers": "Origin,Content-Type,Authorization,locale",
|
|
||||||
"Access-Control-Allow-Credentials": 'true', // Required for cookies, authorization headers with HTTPS
|
|
||||||
"Access-Control-Allow-Methods": "POST, GET, OPTIONS",
|
|
||||||
"Authorization": 'Bearer $authToken',
|
"Authorization": 'Bearer $authToken',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: workouttest_util
|
name: workouttest_util
|
||||||
description: Workout Test app and web functions.
|
description: Workout Test app and web functions.
|
||||||
version: 1.0.22
|
version: 1.0.23
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.6 <3.0.0"
|
sdk: ">=2.18.6 <3.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user