hunk.code_window:       : UNDEFINED
     )
     // Override the cache if a new provider is given.
     if (cacheHandle) {
       extendedConfig.cache = cacheHandle[0]
       extendedConfig.mutate = cacheHandle[1]
     }
  
hunk.labels: keep keep keep keep replace replace replace keep keep
hunk.after_edit:   if (cacheContext) {
       extendedConfig.cache = cacheContext[0]
       extendedConfig.mutate = cacheContext[1]
  
hunk.file_path: src/utils/config-context.ts
hunk.type: replace
file: import Button from '../components/button'
  import fetch from '../libs/fetch'
  import { login, logout } from '../libs/auth'
  
  import useSWR from 'swr'
  
  export default function Index() {
    const { data, mutate } = useSWR('/api/user', fetch)
  
    if (!data) return <h1>loading...</h1>
    if (data.loggedIn) {
      return <div>
        <h1>Welcome, {data.name}</h1>
        <img src={data.avatar} width={80} />
        <Button onClick={() => {
          logout()
          mutate() // after logging in/out, we mutate the SWR
        }}>Logout</Button>
      </div>
    } else {
      return <div>
        <h1>Please login</h1>
        <Button onClick={() => {
          login()
          mutate()
        }}>Login</Button>
      </div>
    }
  }
  