mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 07:37:11 +01:00
Fix TypeScript type errors across multiple files
Some checks failed
Node.js CI / build (push) Has been cancelled
Some checks failed
Node.js CI / build (push) Has been cancelled
This commit is contained in:
parent
860e6390f1
commit
a3733b0424
12 changed files with 38 additions and 15 deletions
|
|
@ -13,7 +13,7 @@ interface UseMessages {
|
|||
messages: typeof messages;
|
||||
labels: typeof labels;
|
||||
getMessage: (id: string) => string;
|
||||
getErrorMessage: (error: ApiError) => string | undefined;
|
||||
getErrorMessage: (error: string | Error | ApiError) => string | undefined;
|
||||
FormattedMessage: typeof FormattedMessage;
|
||||
}
|
||||
|
||||
|
|
@ -26,12 +26,16 @@ export function useMessages(): UseMessages {
|
|||
return message ? formatMessage(message) : id;
|
||||
};
|
||||
|
||||
const getErrorMessage = (error: ApiError) => {
|
||||
const getErrorMessage = (error: string | Error | ApiError) => {
|
||||
if (!error) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const code = error?.code;
|
||||
if (typeof error === 'string') {
|
||||
return error;
|
||||
}
|
||||
|
||||
const code = (error as ApiError)?.code;
|
||||
|
||||
return code ? getMessage(code) : error?.message || 'Unknown error';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export function LanguageButton() {
|
|||
</Icon>
|
||||
</Button>
|
||||
<Popover placement="bottom end">
|
||||
<Dialog variant="menu">
|
||||
<Dialog variant="sheet">
|
||||
<Grid columns="repeat(3, minmax(200px, 1fr))" overflow="hidden">
|
||||
{items.map(({ value, label }) => {
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue