Skip to content

Commit baa9c29

Browse files
committed
Fix use case
1 parent 4a619ec commit baa9c29

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/src/main/java/com/codingwithmitch/openapi/business/interactors/blog/IsAuthorOfBlogPost.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import com.codingwithmitch.openapi.business.domain.util.ErrorHandling.Companion.
1010
import com.codingwithmitch.openapi.business.domain.util.MessageType
1111
import com.codingwithmitch.openapi.business.domain.util.Response
1212
import com.codingwithmitch.openapi.business.domain.util.SuccessHandling.Companion.RESPONSE_HAS_PERMISSION_TO_EDIT
13+
import com.codingwithmitch.openapi.business.domain.util.SuccessHandling.Companion.RESPONSE_NO_PERMISSION_TO_EDIT
1314
import com.codingwithmitch.openapi.business.domain.util.UIComponentType
1415
import kotlinx.coroutines.flow.Flow
1516
import kotlinx.coroutines.flow.catch
@@ -35,6 +36,17 @@ class IsAuthorOfBlogPost(
3536
if(response.response == RESPONSE_HAS_PERMISSION_TO_EDIT){
3637
emit(DataState.data(response = null, true))
3738
}
39+
else if(response.response == GENERIC_ERROR
40+
&& response.errorMessage == RESPONSE_NO_PERMISSION_TO_EDIT){
41+
emit(DataState.data(
42+
response = Response(
43+
message = response.errorMessage,
44+
uiComponentType = UIComponentType.None(),
45+
messageType = MessageType.Success()
46+
),
47+
data = false
48+
))
49+
}
3850
else if(response.response == GENERIC_ERROR){
3951
emit(DataState.data(
4052
response = Response(

0 commit comments

Comments
 (0)