mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 04:37:25 +01:00
Added handling for unauthorized responses when validating an auth token.
Previously, any unsuccessful response would trigger the onValidateAuthTokenFailed callback. Now, if the response is 401 Unauthorized (indicating an invalid token), the onValidateAuthTokenFailed callback will be called. Other errors are still ignored.
This commit is contained in:
parent
ae125feae0
commit
b68bf50359
@ -116,9 +116,10 @@ public class FetchUserData {
|
||||
public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) {
|
||||
if (response.isSuccessful()) {
|
||||
validateAuthTokenListener.onValidateAuthTokenSuccess();
|
||||
} else {
|
||||
} else if (response.code() == 401) { // Unauthorized = token is invalid
|
||||
validateAuthTokenListener.onValidateAuthTokenFailed();
|
||||
}
|
||||
// Other errors are ignored, e.g. server failure
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user