Skip to content

Commit 8b0994f

Browse files
committed
feat: instagram returns refresh token, but it's actually that the user post too much
1 parent b8e3f53 commit 8b0994f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

libraries/nestjs-libraries/src/integrations/social.abstract.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,9 @@ export abstract class SocialAbstract {
6969
return this.fetch(url, options, identifier, totalRetries + 1);
7070
}
7171

72-
const handleError = this.handleErrors(json || '{}') || {
73-
type: 'bad-body',
74-
value: '',
75-
};
72+
const handleError = this.handleErrors(json || '{}');
7673

77-
if (request.status === 401 || handleError?.type === 'refresh-token') {
74+
if (request.status === 401 && (handleError?.type === 'refresh-token' || !handleError)) {
7875
console.log('refresh token', json);
7976
throw new RefreshToken(
8077
identifier,
@@ -84,7 +81,7 @@ export abstract class SocialAbstract {
8481
);
8582
}
8683

87-
throw new BadBody(identifier, json, options.body!, handleError?.value);
84+
throw new BadBody(identifier, json, options.body!, handleError?.value || '');
8885
}
8986

9087
checkScopes(required: string[], got: string | string[]) {

0 commit comments

Comments
 (0)