Handles group plans in unauthorized error check

This commit is contained in:
Hafiz 2025-07-02 15:50:26 -05:00
parent f544f89c3a
commit 6d076888a1

View file

@ -159,7 +159,8 @@ class ApiClientImpl(
when (response.code) {
401 -> {
val path = response.request.url.encodedPath
if (!path.contains("/user/auth/update-password")) {
if (!path.contains("/user/auth/update-password") && !path.contains("group-plans")) {
val bodyStr = try {
response.peekBody(1024).string()
} catch (_: Exception) {
@ -172,10 +173,10 @@ class ApiClientImpl(
} catch (_: Exception) {
"" to ""
}
val shouldLogout = errField.equals("missingAuthHeaders", ignoreCase = true)
|| errField.equals("invalidCredentials", ignoreCase = true)
|| msgField.contains("invalidCredentials", ignoreCase = true)
|| errField.equals("invalidCredentials", ignoreCase = true)
|| msgField.contains("invalidCredentials", ignoreCase = true)
|| msgField.contains("Missing authentication headers", ignoreCase = true)
|| msgField.contains("There is no account that uses those credentials", ignoreCase = true)