Skip to content

Commit

Permalink
FEAT: Adding vue3-toastify in app #15
Browse files Browse the repository at this point in the history
  • Loading branch information
Caussz committed Jul 14, 2024
1 parent 2cdee19 commit 9ce0dbf
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dev-dist/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ define(['./workbox-b5f7729d'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812"
}, {
"url": "index.html",
"revision": "0.rijo4jsbfi8"
"revision": "0.f6gfohgemco"
}], {});
workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
Expand Down
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"vue": "^3.4.29",
"vue-material-design-icons": "^5.2.0",
"vue-router": "^4.3.3",
"vue3-toastify": "^0.2.2",
"workbox-precaching": "^7.1.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Api } from "./axios/api";
import { showMessage } from "./toast/toastify";

export { Api }
export { Api, showMessage }
28 changes: 28 additions & 0 deletions src/plugins/toast/toastify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { toast } from "vue3-toastify";

/**
* Displays a toast notification with specified options.
*
* @param {string} message - The message to be displayed in the toast notification. It can contain HTML.
* @param {'success'|'error'|'info'|'warning'} type - The type of the toast notification. Defaults to 'default'.
* @param {number} time - The duration (in milliseconds) for which the toast should be visible.
* @param {'top-left'|'top-center'|'top-right'|'bottom-left'|'bottom-center'|'bottom-right'} position - The position of the toast notification on the screen. Defaults to 'top-right'.
* @param {'auto'|'light'|'dark'|'colored'} theme - The theme of the toast notification. Defaults to 'auto'.
* @param {boolean} bar - Determines if the progress bar should be visible. Defaults to false.
*
* @example
* showMessage('This is a success message', 'success', 3000, 'top-right', 'light', true);
*/
async function showMessage(message: any, type: any, time: number, position: any, theme: any, bar: boolean ) {
toast(message, {
"theme": theme || 'auto',
"type": type || 'default',
"position": position || 'top-right',
"pauseOnFocusLoss": false,
"autoClose": time,
"hideProgressBar": bar || false,
"dangerouslyHTMLString": true
})
}

export { showMessage }

0 comments on commit 9ce0dbf

Please sign in to comment.