-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEAT: Adding vue3-toastify in app #15
- Loading branch information
Showing
5 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } |