33 lines
788 B
JavaScript
Raw Normal View History

2023-07-24 13:35:05 -05:00
import Button from 'react-bootstrap/Button'
import { CenterLayout } from '../components/layout'
2023-06-19 20:26:34 -05:00
import Snl from '../components/snl'
import { gql } from 'graphql-tag'
2023-06-19 20:26:34 -05:00
import { useMutation, useQuery } from '@apollo/client'
export default function Index () {
const [toggle] = useMutation(
gql`
mutation onAirToggle {
onAirToggle
}`, {
update (cache, { data: { onAirToggle } }) {
cache.modify({
id: 'ROOT_QUERY',
fields: {
snl: () => onAirToggle
}
})
}
}
)
const { data } = useQuery(gql`{ snl }`)
2023-06-19 20:26:34 -05:00
return (
<CenterLayout>
2023-06-19 20:26:34 -05:00
<Snl />
<Button variant={data?.snl ? 'primary' : 'danger'} onClick={toggle}>go: {data?.snl ? 'off' : 'on'} air</Button>
</CenterLayout>
2023-06-19 20:26:34 -05:00
)
}