@ludo.ninja/components 2.4.47 → 2.4.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,7 +14,7 @@ function useCheckFollow(twitterUserName, targetId = '1566713352138760197') {
|
|
|
14
14
|
setLoading(true);
|
|
15
15
|
setError(null);
|
|
16
16
|
try {
|
|
17
|
-
const urlGetUserTwitterId = `https://twitter-api47.p.rapidapi.com/
|
|
17
|
+
const urlGetUserTwitterId = `https://twitter-api47.p.rapidapi.com/v3/user/by-username?username=${twitterUserName}`;
|
|
18
18
|
const userRes = await fetch(urlGetUserTwitterId, {
|
|
19
19
|
headers: {
|
|
20
20
|
'x-rapidapi-host': 'twitter-api47.p.rapidapi.com',
|
|
@@ -22,11 +22,11 @@ function useCheckFollow(twitterUserName, targetId = '1566713352138760197') {
|
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
24
|
const userData = await userRes.json();
|
|
25
|
-
const twitterUserId = userData?.
|
|
25
|
+
const twitterUserId = userData?.data?.id;
|
|
26
26
|
if (!twitterUserId) {
|
|
27
27
|
throw new Error('Error loading twitter user ID');
|
|
28
28
|
}
|
|
29
|
-
const urlCheckFollow = `https://twitter-api47.p.rapidapi.com/
|
|
29
|
+
const urlCheckFollow = `https://twitter-api47.p.rapidapi.com/v3/user/friendship?subjectId=${twitterUserId}&targetId=${targetId}`;
|
|
30
30
|
const followRes = await fetch(urlCheckFollow, {
|
|
31
31
|
headers: {
|
|
32
32
|
'x-rapidapi-host': 'twitter-api47.p.rapidapi.com',
|
|
@@ -35,7 +35,7 @@ function useCheckFollow(twitterUserName, targetId = '1566713352138760197') {
|
|
|
35
35
|
});
|
|
36
36
|
const followData = await followRes.json();
|
|
37
37
|
setStatus({
|
|
38
|
-
following: followData?.
|
|
38
|
+
following: followData?.data?.following || false,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
catch (err) {
|