1
0
mirror of https://github.com/go-vikunja/app synced 2024-06-02 18:49:47 +00:00

moved base validation to client class

added check for spaces
This commit is contained in:
Benimautner 2023-01-24 17:52:34 +01:00
parent a31e4542b8
commit 593a58d672
2 changed files with 5 additions and 3 deletions

View File

@ -59,8 +59,12 @@ class Client {
void configure({String? token, String? base, bool? authenticated}) {
if (token != null)
_token = token;
if (base != null)
if (base != null) {
base = base.replaceAll(" ", "");
if(base.endsWith("/"))
base = base.substring(0,base.length-1);
_base = base.endsWith('/api/v1') ? base : '$base/api/v1';
}
if (authenticated != null)
this.authenticated = authenticated;
}

View File

@ -184,8 +184,6 @@ class _LoginPageState extends State<LoginPage> {
setState(() => _loading = true);
try {
var vGlobal = VikunjaGlobal.of(context);
if(_server.endsWith("/"))
_server = _server.substring(0,_server.length-1);
vGlobal.client.configure(base: _server);
Server? info = await vGlobal.serverService.getInfo();
if(info == null)