8294d6ee49
- Created `qa-test-output-after-fix.txt` and `qa-test-output.txt` to log results of certificate page authentication tests. - Added `build.sh` for deterministic backend builds in CI, utilizing `go list` for efficiency. - Introduced `codeql_scan.sh` for CodeQL database creation and analysis for Go and JavaScript/TypeScript. - Implemented `dockerfile_check.sh` to validate Dockerfiles for base image and package manager mismatches. - Added `sourcery_precommit_wrapper.sh` to facilitate Sourcery CLI usage in pre-commit hooks.
30 lines
820 B
TypeScript
30 lines
820 B
TypeScript
type ToastType = 'success' | 'error' | 'info' | 'warning'
|
|
|
|
export interface Toast {
|
|
id: number
|
|
message: string
|
|
type: ToastType
|
|
}
|
|
|
|
let toastId = 0
|
|
export const toastCallbacks = new Set<(toast: Toast) => void>()
|
|
|
|
export const toast = {
|
|
success: (message: string) => {
|
|
const id = ++toastId
|
|
toastCallbacks.forEach(callback => callback({ id, message, type: 'success' }))
|
|
},
|
|
error: (message: string) => {
|
|
const id = ++toastId
|
|
toastCallbacks.forEach(callback => callback({ id, message, type: 'error' }))
|
|
},
|
|
info: (message: string) => {
|
|
const id = ++toastId
|
|
toastCallbacks.forEach(callback => callback({ id, message, type: 'info' }))
|
|
},
|
|
warning: (message: string) => {
|
|
const id = ++toastId
|
|
toastCallbacks.forEach(callback => callback({ id, message, type: 'warning' }))
|
|
},
|
|
}
|