0

进行时间表延期,但我得到了这个:在此处输入图像描述

我的问题是,我试图让它与谷歌日历
api 一起工作,但我似乎无法找出问题所在,
这是我的代码:

import React, {useEffect, useState, useContext} from "react"
import { Global } from '@emotion/core'
import ical from 'ical';
import {MyThemeContext} from '../contexts/theme-context'
import EventList from '../components/event-list'


const HomePage = () => {
    const [cal, setCal] = useState(null)
    const streamerName = "bobrossrtx"
    const {theme } = useContext(MyThemeContext)

    useEffect(() => {
      const fetchCal = async () => {
          const parsed = await ical.fromURL(
            'https://calendar.google.com/calendar/ical/5gvmiv5v1qblaoptns3p0avhs0%40group.calendar.google.com/public/basic.ics'
          );

          setCal(parsed);
        };

        fetchCal();
    }, [])

    return (
        <>
        <Global styles={{body: { backgroundColor: theme.colors.background}}} />
    <main>
<h1>{streamerName}'s Calendar</h1>
        <EventList events={[{
            id:0,
            title:"Create a Twitch Extension with Darrik Moberg",
            date: new Date('November 25, 2019 10:30:00'),
            description: "If you want to show specific information on a Twitch profile, how do you do that? In this episode, Learn With Jason moderator Darrik Moberg (https://twitter.com/MDarrik) teaches us how to create custom extensions for Twitch that work on both the website and apps."
        }]} />
        <pre>{JSON.stringify(cal, null, 2)}</pre>
    </main>
    </>
)}

export default HomePage
4

0 回答 0