File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
app/src/main/java/com/codingwithmitch/openapi/business/interactors/blog Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import com.codingwithmitch.openapi.business.domain.util.ErrorHandling.Companion.
10
10
import com.codingwithmitch.openapi.business.domain.util.MessageType
11
11
import com.codingwithmitch.openapi.business.domain.util.Response
12
12
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
13
14
import com.codingwithmitch.openapi.business.domain.util.UIComponentType
14
15
import kotlinx.coroutines.flow.Flow
15
16
import kotlinx.coroutines.flow.catch
@@ -35,6 +36,17 @@ class IsAuthorOfBlogPost(
35
36
if (response.response == RESPONSE_HAS_PERMISSION_TO_EDIT ){
36
37
emit(DataState .data(response = null , true ))
37
38
}
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
+ }
38
50
else if (response.response == GENERIC_ERROR ){
39
51
emit(DataState .data(
40
52
response = Response (
You can’t perform that action at this time.
0 commit comments