🐛 Fix captcha
This commit is contained in:
@@ -1,17 +1,10 @@
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/pods/network.dart';
|
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
part 'captcha.config.g.dart';
|
part 'captcha.config.g.dart';
|
||||||
|
|
||||||
@riverpod
|
@riverpod
|
||||||
Future<String> captchaUrl(Ref ref) async {
|
Future<String> captchaUrl(Ref ref) async {
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
const baseUrl = "https://solian.app";
|
||||||
final resp = await apiClient.get('/.well-known/services');
|
return '$baseUrl/auth/captcha';
|
||||||
final serviceMapping = await resp.data;
|
|
||||||
var baseUrl = serviceMapping['DysonNetwork.Pass'] as String;
|
|
||||||
// The backend using self-signed certicates on development
|
|
||||||
// Which mobile simulator might not accept, use this to avoid errors
|
|
||||||
if (baseUrl.contains('https://localhost')) baseUrl = 'http://localhost:5216';
|
|
||||||
return '$baseUrl/captcha';
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user