PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / trunk
Hostinger Reach – AI-Powered Email Marketing for WordPress vtrunk
1.8.0 1.7.2 1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / frontend / vue / composables / useToast.ts
hostinger-reach / frontend / vue / composables Last commit date
index.ts 1 year ago useAmplitudeEvent.ts 4 months ago useHostingData.ts 4 months ago useModal.ts 1 year ago useOverviewData.ts 10 months ago useReachUrls.ts 1 week ago useScrollLock.ts 1 year ago useServerPagination.ts 11 months ago useToast.ts 1 year ago
useToast.ts
50 lines
1 import { useHToast } from '@hostinger/hcomponents';
2
3 let globalToastService: ReturnType<typeof useHToast> | null = null;
4
5 export const useToast = () => {
6 if (!globalToastService) {
7 globalToastService = useHToast();
8 }
9
10 const showSuccess = (message: string, sticky = false) => {
11 globalToastService?.add({
12 message,
13 severity: 'success',
14 sticky
15 });
16 };
17
18 const showError = (message: string, sticky = false) => {
19 globalToastService?.add({
20 message,
21 severity: 'failure',
22 sticky
23 });
24 };
25
26 const showInfo = (message: string, sticky = false) => {
27 globalToastService?.add({
28 message,
29 severity: 'info',
30 sticky
31 });
32 };
33
34 const showWarning = (message: string, sticky = false) => {
35 globalToastService?.add({
36 message,
37 severity: 'warning',
38 sticky
39 });
40 };
41
42 return {
43 showSuccess,
44 showError,
45 showInfo,
46 showWarning,
47 toastService: globalToastService
48 };
49 };
50