22 lines
517 B
Dart
22 lines
517 B
Dart
import 'package:dio/dio.dart';
|
|
import 'package:server/client.dart';
|
|
|
|
class Tokens {
|
|
String lastError = '';
|
|
|
|
getAccessToken() async {
|
|
try {
|
|
final response = await api.get('/collections/_authOrigins/records');
|
|
return response.data['items'][0]['id'];
|
|
} on DioException catch (e) {
|
|
if (e.type == DioExceptionType.connectionError) {
|
|
lastError = 'Internet Connection Error';
|
|
} else {
|
|
lastError = e.response!.data['message'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
final tokens = Tokens();
|