0π
β
If you are trying to use the named reference of VueJwtDecode
, you need to reimport the library in your Signup.vue compoenent since Signup.vue doesnβt understand what VueJwtDecode
means.
import VueJwtDecode from 'vue-jwt-decode'
const payload = VueJwtDecode.decode(res.jwt);
However, since you have globally installed the library, it has been installed to the Vue instance, meaning that it is available from the this
context within your component. As a result, you can also access it from the component context without reimporting:
const payload = this.$jwtDec(res.jwt);
π€David L
0π
As document, in your component, you need to use
this.$jwtDec(res.jwt)
instead of
VueJwtDecode.decode(res.jwt);
π€ittus
Source:stackexchange.com