add reponse http

This commit is contained in:
Valentin CZERYBA 2024-07-26 15:06:15 +02:00
parent c44f1e51ea
commit e320fccefa
2 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'events.dart'; import 'events.dart';
import '../variable/globals.dart' as globals;
import 'package:http/http.dart' as http;
import 'dart:io';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -7,6 +10,11 @@ mixin ShowDescImageAdd<T extends StatefulWidget> on State<T> {
Future<void> addEvents(var events) async { Future<void> addEvents(var events) async {
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();
var accessToken = prefs.getString("access_token") ?? ""; var accessToken = prefs.getString("access_token") ?? "";
if (accessToken.isNotEmpty) {
var urlGet = Uri.parse("${globals.api}/events");
var responseGet = await http.get(urlGet,
headers: {HttpHeaders.cookieHeader: 'access_token=${accessToken}'});
}
} }
void showDescImageAddDialog(BuildContext context, var events) { void showDescImageAddDialog(BuildContext context, var events) {

View File

@ -7,7 +7,6 @@ import 'package:flutter_gemini/flutter_gemini.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'dart:io';
import 'dart:convert'; import 'dart:convert';
import '../variable/globals.dart' as globals; import '../variable/globals.dart' as globals;