@@ -141,14 +141,8 @@ const userService = {
141
141
cache . client ?. del ( key ) ;
142
142
return true ;
143
143
} ,
144
- async follow ( followingUserId : string , postId : string , cookies : Cookies ) {
144
+ async follow ( followingUserId : string , cookies : Cookies ) {
145
145
try {
146
- const post = await postService . findPostById ( postId ) ;
147
-
148
- if ( ! post ) {
149
- throw new ApolloError ( 'Post not found' , 'NOT_FOUND' ) ;
150
- }
151
-
152
146
const query = 'mutation Follow ($input: FollowInput!) {\n\tfollow(input: $input) \n}' ;
153
147
154
148
const accessToken = cookies . get ( 'access_token' ) ?? '' ;
@@ -173,20 +167,14 @@ const userService = {
173
167
}
174
168
) ;
175
169
176
- return { id : post . id } ;
170
+ return { id : followingUserId , is_followed : true } ;
177
171
} catch ( error : any ) {
178
172
console . log ( 'follow error:' , error . response . data . errors ) ;
179
173
return false ;
180
174
}
181
175
} ,
182
- async unfollow ( followingUserId : string , postId : string , cookies : Cookies ) {
176
+ async unfollow ( followingUserId : string , cookies : Cookies ) {
183
177
try {
184
- const post = await postService . findPostById ( postId ) ;
185
-
186
- if ( ! post ) {
187
- throw new ApolloError ( 'Post not found' , 'NOT_FOUND' ) ;
188
- }
189
-
190
178
const query = 'mutation Unfollow ($input: UnfollowInput!) {\n\tunfollow(input: $input) \n}' ;
191
179
192
180
const accessToken = cookies . get ( 'access_token' ) ?? '' ;
@@ -211,7 +199,7 @@ const userService = {
211
199
}
212
200
) ;
213
201
214
- return { id : post . id } ;
202
+ return { id : followingUserId , is_followed : false } ;
215
203
} catch ( error : any ) {
216
204
console . log ( 'unfollow error:' , error . response . data . errors ) ;
217
205
return false ;
0 commit comments