mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-07-10 02:55:23 +02: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:
@ -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
|
||||
|
Reference in New Issue
Block a user