Force auth

This commit is contained in:
Jared Palmer 2023-06-22 10:37:35 -07:00
parent 1cc1beb63e
commit c8aefcab04
5 changed files with 26 additions and 9 deletions

View file

@ -19,6 +19,7 @@ import {
import { useState } from 'react'
import { Button } from './ui/button'
import { Input } from './ui/input'
import { toast } from 'react-hot-toast'
const IS_PREVIEW = process.env.VERCEL_ENV === 'preview'
export interface ChatProps extends React.ComponentProps<'div'> {
@ -40,6 +41,11 @@ export function Chat({ id, initialMessages, className }: ChatProps) {
body: {
id,
previewToken
},
onResponse(response) {
if (response.status === 401) {
toast.error(response.statusText)
}
}
})
return (