I'm encountering an issue with page reloads.
Whenever I save on Vscode, it displays correctly on my HTML page. However, upon refreshing the page, the data becomes undefined. The data in the store is functioning properly, but it seems to be only affecting the view profile after reloading the page. If you have any suggestions or solutions, please share as I am at a loss for what to do next.
views/Profile:
<div class="input-group mb-3">
<span class="input-group-text" id="form-lastName">Last Name :</span>
<input
type="text"
class="form-control"
aria-label="Username"
v-model="lastName"
ref="string"
/>
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="form-firstName">First Name :</span>
<input
type="text"
class="form-control"
aria-label="Username"
v-model="firstName"
ref="string"
/>
</div>
----------
export default {
name: "ProfileC",
data: function () {
return {
lastName: "",
firstName: "",
selectedFile: "",
};
},
components: {
NavbarC,
},
mounted: function () {
this.lastName = this.$store.state.userInfos.user_lastName;
this.firstName = this.$store.state.userInfos.user_firstName;
----------
store/index.js
const store = createStore({
state: {
status: '',
user: user,
userInfos: {
lastName: '',
firstName: '',
email: '',
image: '',
},
dataArticles: [],
dataComments: [],
articleInfos: {
message: '',
image: '',
},
comments: [],
},
mutations: {
updateUserInfos: function (state, userInfos) {
state.userInfos = userInfos;
},
},