fix
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
import { building } from "$app/environment";
|
||||||
import { HASH_SECRET, TWITCH_APP_CLIENT_ID, TWITCH_APP_SECRET } from "$env/static/private";
|
import { HASH_SECRET, TWITCH_APP_CLIENT_ID, TWITCH_APP_SECRET } from "$env/static/private";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
@ -42,6 +43,10 @@ export const twitchFollowEvent = z.object({
|
|||||||
// Webhook -> Redeem of channel reward
|
// Webhook -> Redeem of channel reward
|
||||||
export const createTwitchClient = () => {
|
export const createTwitchClient = () => {
|
||||||
const getAccessToken = async () => {
|
const getAccessToken = async () => {
|
||||||
|
if (building) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
const authUrl = `https://id.twitch.tv/oauth2/authorize` +
|
const authUrl = `https://id.twitch.tv/oauth2/authorize` +
|
||||||
`?response_type=code` +
|
`?response_type=code` +
|
||||||
`&client_id=${TWITCH_APP_CLIENT_ID}` +
|
`&client_id=${TWITCH_APP_CLIENT_ID}` +
|
||||||
@ -71,7 +76,6 @@ export const createTwitchClient = () => {
|
|||||||
const _access_token = getAccessToken();
|
const _access_token = getAccessToken();
|
||||||
|
|
||||||
const subscribeToFollow = async () => {
|
const subscribeToFollow = async () => {
|
||||||
console.log(await _access_token);
|
|
||||||
const twitchSubResponse = await fetch(
|
const twitchSubResponse = await fetch(
|
||||||
"https://api.twitch.tv/helix/eventsub/subscriptions",
|
"https://api.twitch.tv/helix/eventsub/subscriptions",
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user