How to call BToast from outside Vue
See original GitHub issueHi, I want to use the BToast
component outside of Vue.js, is there any way I can call it? For example, I want to launch a toast
whenever a request I make with axios
results in an error. So I define my interceptors:
const service = axios.create({
baseURL: '/api',
timeout: 10000,
});
service.interceptors.response.use(
response => {
return response.data;
},
error => {
// How can I call a Toast from here? <----
return Promise.reject(error);
}
);
Thank you very much in advance
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How can I put toast messages in a separate file when unsing ...
Create an external file and import that file into your main.js. toasts.js import Vue from 'vue' import Toasted from 'vue-toasted' ...
Read more >Toast | Components - BootstrapVue
bvToast.toast() are children of the Vue instance that calls the this.$bvToast.toast() method, and will be hidden and destroyed if that Vue instance (i.e. ......
Read more >How to run Bootstrapvue Toasts inside vuex Module - Laracasts
This is assuming you've installed bootstrap vue through npm or yarn. import { ToastPlugin } from 'bootstrap-vue' Vue. use(ToastPlugin) const app = new...
Read more >vue-on-toast - npm
Start using vue-on-toast in your project by running `npm i ... must be included in your application, preferably outside of your router.
Read more >Show and Hide the Toast - DevExtreme - DevExpress
With Angular, Vue, or React, use a different technique. Bind the visible property of the Toast UI component to a component property.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have a somewhat similar setup and do the following:
In your main file, export your app instance:
And in my Axios setup file, I have the following:
Hello @tmorehouse , thank you very much for your response, but your solution returns the following message:
I show you the complete file with which I am catching
axios
errors.