_App.vue_
```html
```
```js
import { onAuthUIStateChange } from '@aws-amplify/ui-components'
export default {
name: 'AuthStateApp',
created() {
this.unsubscribeAuth = onAuthUIStateChange((authState, authData) => {
this.authState = authState;
this.user = authData;
})
},
data() {
return {
user: undefined,
authState: undefined,
unsubscribeAuth: undefined
formFields: [
{ type: "username" },
{ type: "password" },
{ type: "email" }
],
}
},
beforeUnmount() {
this.unsubscribeAuth();
}
}
```
```js
import { onAuthUIStateChange } from '@aws-amplify/ui-components'
export default {
name: 'AuthStateApp',
created() {
this.unsubscribeAuth = onAuthUIStateChange((authState, authData) => {
this.authState = authState;
this.user = authData;
})
},
data() {
return {
user: undefined,
authState: undefined,
unsubscribeAuth: undefined,
formFields: [
{ type: "username" },
{ type: "password" },
{ type: "email" }
]
}
},
beforeDestroy() {
this.unsubscribeAuth();
}
}
```