mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-17 04:59:30 +00:00
wip trpc
This commit is contained in:
20
apps/client/src/lib/common.ts
Normal file
20
apps/client/src/lib/common.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { addToast } from './store';
|
||||
|
||||
export const asyncSleep = (delay: number) => new Promise((resolve) => setTimeout(resolve, delay));
|
||||
|
||||
export function errorNotification(error: any | { message: string }): void {
|
||||
if (error instanceof Error) {
|
||||
addToast({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
addToast({
|
||||
message: error,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
export function getRndInteger(min: number, max: number) {
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
Reference in New Issue
Block a user