change readme

This commit is contained in:
zoe 2022-07-09 12:48:21 +02:00
parent cfb4611ec5
commit 3f068f246e
3 changed files with 15 additions and 18 deletions

View File

@ -1,16 +1,3 @@
# slothmu
# loris
A new Flutter project.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
the best fedi client for gotosocial and mastodon (soon)(i promise)

View File

@ -1,20 +1,32 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import '../settings.dart' as settings;
import '../../global.dart' as global;
class Timeline {}
Future<http.Response> getTimelineFromServer() async {
const limit = 4;
final token = await settings.loadToken();
final baseUrl = await settings.loadInstanceUrl();
final url = Uri(
scheme: "https",
host: baseUrl,
path: "/api/v1/timelines/home",
queryParameters: {"limit": limit.toString()},
);
Map<String, String> headers = {"Authorization": "Bearer $token"};
headers.addAll(global.defaultHeaders);
final response = await http.get(url, headers: headers);
final json = jsonDecode(response.body);
int i = 0;
while (i < limit) {
print(json[i]["id"]);
i ++;
}
return response;
}

View File

@ -30,8 +30,6 @@ class _TimelineState extends State<Timeline> {
Future fetchMore() async {
loading = true;
final response = await tl.getTimelineFromServer();
print(response.body);
print(response.statusCode);
setState(() {
if (children.isNotEmpty) {
children.removeAt(children.length - 1);