feat
This commit is contained in:
@ -38,6 +38,7 @@ export const twitchChallengeEvent = z.object({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Not the complete event, but the information we need.
|
// Not the complete event, but the information we need.
|
||||||
export const twitchFollowEvent = z.object({
|
export const twitchFollowEvent = z.object({
|
||||||
subscription: z.object({
|
subscription: z.object({
|
||||||
@ -114,7 +115,26 @@ export const createTwitchClient = () => {
|
|||||||
console.log("Subscribe to follow: ", res);
|
console.log("Subscribe to follow: ", res);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getSubscriptionStatus = async () => {
|
||||||
|
const twitchSubResponse = await fetch(
|
||||||
|
"https://api.twitch.tv/helix/eventsub/subscriptions",
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${await _access_token}`,
|
||||||
|
"Client-Id": TWITCH_APP_CLIENT_ID,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const res = await twitchSubResponse.json();
|
||||||
|
console.log("-------------------")
|
||||||
|
console.log("Subscription status");
|
||||||
|
console.log(res);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
subscribeToFollow,
|
subscribeToFollow,
|
||||||
|
getSubscriptionStatus,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
8
src/routes/+page.ts
Normal file
8
src/routes/+page.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { twitchClient } from "$lib";
|
||||||
|
import type { PageLoad } from "./$types";
|
||||||
|
|
||||||
|
export const load: PageLoad = async ({ params }) => {
|
||||||
|
await twitchClient.getSubscriptionStatus();
|
||||||
|
|
||||||
|
return {};
|
||||||
|
};
|
Reference in New Issue
Block a user