Change if-elseif to case switch for test schools
This commit is contained in:
parent
14bcb62184
commit
a805d8292f
@ -83,7 +83,10 @@ Future loginAPI({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if institute matches one of test things do test login
|
// if institute matches one of test things do test login
|
||||||
if (instituteCode == 'refilc-test-sweden') {
|
switch (instituteCode) {
|
||||||
|
// by using a switch statement we are saving a whopping 0.0000001 seconds
|
||||||
|
// (actually it just makes it easier to add more test schools later on)
|
||||||
|
case 'refilc-test-sweden':
|
||||||
School school = School(
|
School school = School(
|
||||||
city: "Stockholm",
|
city: "Stockholm",
|
||||||
instituteCode: "refilc-test-sweden",
|
instituteCode: "refilc-test-sweden",
|
||||||
@ -91,7 +94,8 @@ Future loginAPI({
|
|||||||
);
|
);
|
||||||
|
|
||||||
await testLogin(school);
|
await testLogin(school);
|
||||||
} else if (instituteCode == 'refilc-test-spain') {
|
break;
|
||||||
|
case 'refilc-test-spain':
|
||||||
School school = School(
|
School school = School(
|
||||||
city: "Madrid",
|
city: "Madrid",
|
||||||
instituteCode: "refilc-test-spain",
|
instituteCode: "refilc-test-spain",
|
||||||
@ -99,7 +103,8 @@ Future loginAPI({
|
|||||||
);
|
);
|
||||||
|
|
||||||
await testLogin(school);
|
await testLogin(school);
|
||||||
} else {
|
break;
|
||||||
|
default:
|
||||||
// normal login from here
|
// normal login from here
|
||||||
Provider.of<KretaClient>(context, listen: false).userAgent =
|
Provider.of<KretaClient>(context, listen: false).userAgent =
|
||||||
Provider.of<SettingsProvider>(context, listen: false).config.userAgent;
|
Provider.of<SettingsProvider>(context, listen: false).config.userAgent;
|
||||||
@ -185,6 +190,7 @@ Future loginAPI({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoginState.failed;
|
return LoginState.failed;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user