fix: response error toast style
Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
parent
e205f393fb
commit
7748588608
|
|
@ -7,6 +7,8 @@ import { toast } from "sonner"
|
|||
|
||||
import { CopyButton } from "~/components/ui/code-highlighter"
|
||||
import { Markdown } from "~/components/ui/markdown/Markdown"
|
||||
import { isDev } from "~/constants"
|
||||
import { DebugRegistry } from "~/modules/debug/registry"
|
||||
|
||||
export const getFetchErrorMessage = (error: Error) => {
|
||||
if (error instanceof FetchError) {
|
||||
|
|
@ -62,7 +64,7 @@ export const toastFetchError = (
|
|||
..._toastOptions,
|
||||
classNames: {
|
||||
toast: "items-start bg-theme-background",
|
||||
title: tw`-mt-0.5`, // to align with the icon (actually cut the top space from line-height)
|
||||
|
||||
content: "w-full",
|
||||
..._toastOptions.classNames,
|
||||
},
|
||||
|
|
@ -95,3 +97,19 @@ export const toastFetchError = (
|
|||
})
|
||||
}
|
||||
}
|
||||
if (isDev) {
|
||||
DebugRegistry.add("Simulate request error", () => {
|
||||
createErrorToaster(
|
||||
"Simulated request error",
|
||||
{},
|
||||
)({
|
||||
response: {
|
||||
_data: JSON.stringify({
|
||||
code: 1000,
|
||||
message: "Simulated request error",
|
||||
reason: "Simulated reason",
|
||||
}),
|
||||
},
|
||||
} as any)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ export const EnvironmentIndicator = () => {
|
|||
<div className="flex flex-col gap-2">
|
||||
{Object.entries(actionMap).map(([key, action]) => {
|
||||
return (
|
||||
<div key={key} className="flex items-center gap-2">
|
||||
<span>{key}</span>
|
||||
<div key={key} className="flex w-full items-center gap-2">
|
||||
<span className="flex flex-1">{key}</span>
|
||||
<Button variant="outline" type="button" onClick={() => action()}>
|
||||
<i className="i-mgc-play-cute-fi size-3" />
|
||||
<span className="ml-1">Run</span>
|
||||
|
|
|
|||
Loading…
Reference in New Issue