1 | # Toast
|
2 | [![npm](https://img.shields.io/npm/dt/@nuxtjs/toast.svg?style=flat-square)](https://npmjs.com/package/@nuxtjs/toast)
|
3 | [![npm (scoped with tag)](https://img.shields.io/npm/v/@nuxtjs/toast/latest.svg?style=flat-square)](https://npmjs.com/package/@nuxtjs/toast)
|
4 |
|
5 | > Easy toasts for your app using [mini-toastr](https://github.com/se-panfilov/mini-toastr).
|
6 |
|
7 | ## Setup
|
8 | - Add `@nuxtjs/toast` dependency using yarn or npm to your project
|
9 | - Add `@nuxtjs/toast` to `modules` section of `nuxt.config.js`
|
10 | ```js
|
11 | {
|
12 | modules: [
|
13 | '@nuxtjs/toast',
|
14 | ]
|
15 | }
|
16 | ````
|
17 |
|
18 | ## Usage
|
19 | ```js
|
20 | export default {
|
21 | methods:{
|
22 | async login() {
|
23 | try {
|
24 | await this.$post('auth/login');
|
25 | this.$success('Welcome :)');
|
26 | } catch(e){
|
27 | this.$error('Error while authenticating');
|
28 | }
|
29 | }
|
30 | }
|
31 | }
|
32 | ```
|