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",
|
||||
"args": [
|
||||
"-d",
|
||||
"chrome"
|
||||
"chrome",
|
||||
"--web-renderer",
|
||||
"html",
|
||||
"--web-port",
|
||||
"48102",
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -1,5 +1,9 @@
|
||||
Workout Test and Diet 4 You Common Util Functions
|
||||
|
||||
### Version 1.0.23
|
||||
|
||||
webapi CORS solution with the API
|
||||
|
||||
### Version 1.0.22
|
||||
|
||||
webapi CORS: only diet4you domains, plugins update
|
||||
|
@ -1,9 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:workouttest_util/model/cache.dart';
|
||||
import 'package:workouttest_util/service/customer_service.dart';
|
||||
import 'package:workouttest_util/service/openai_service.dart';
|
||||
|
||||
void main() {
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await dotenv.load(fileName: ".env");
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@ -14,8 +17,6 @@ class MyApp extends StatefulWidget {
|
||||
State<MyApp> createState() => _MyAppState();
|
||||
}
|
||||
|
||||
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
String _response = "";
|
||||
|
||||
@ -25,20 +26,21 @@ class _MyAppState extends State<MyApp> {
|
||||
}
|
||||
|
||||
void _fetchData() async {
|
||||
var api = OpenAIApi();
|
||||
String response = await api.getOpenAICompletion("Who wrote the song 'yellow submarine'?");
|
||||
//var api = OpenAIApi();
|
||||
//String response = await api.getOpenAICompletion("Who wrote the song 'yellow submarine'?");
|
||||
await CustomerApi().getCustomer(72);
|
||||
String response = "OK";
|
||||
setState(() {
|
||||
_response = response;
|
||||
_response = response;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Cache().setLocalBaseUrl();
|
||||
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Example"),
|
||||
),
|
||||
@ -57,16 +59,12 @@ class _MyAppState extends State<MyApp> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
FloatingActionButton(
|
||||
onPressed:() => {
|
||||
_fetchData()
|
||||
},
|
||||
onPressed: () => {_fetchData()},
|
||||
tooltip: 'Send question',
|
||||
child: const Icon(Icons.ad_units),
|
||||
),
|
||||
|
||||
],
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -27,7 +27,6 @@ class APIWebClient with Common, Logging {
|
||||
final body = jsonEncode(<String, String>{'username': email, 'password': password});
|
||||
var uri = Uri.parse(url);
|
||||
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",
|
||||
"Authorization": "1",
|
||||
});
|
||||
@ -65,10 +64,6 @@ class APIWebClient with Common, Logging {
|
||||
}
|
||||
var uri = Uri.parse(url);
|
||||
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",
|
||||
"Authorization": 'Bearer $authToken',
|
||||
});
|
||||
@ -102,10 +97,6 @@ class APIWebClient with Common, Logging {
|
||||
var uri = Uri.parse(url);
|
||||
var result = await http.get(uri, headers: {
|
||||
"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',
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: workouttest_util
|
||||
description: Workout Test app and web functions.
|
||||
version: 1.0.22
|
||||
version: 1.0.23
|
||||
|
||||
environment:
|
||||
sdk: ">=2.18.6 <3.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user