Change read store using pinia instead localstorage

This commit is contained in:
Amir Hassan
2023-02-22 11:31:58 +08:00
parent b96d0799f3
commit e863d3fd4e
3 changed files with 6 additions and 9 deletions
+2 -1
View File
@@ -48,6 +48,7 @@
<script>
import axios from "axios";
import { useAuthenticationUserStore } from "@/store/modules/authentication";
export default {
data() {
@@ -67,7 +68,7 @@ export default {
await axios
.get("/karat", {
headers: {
Authorization: "Bearer " + localStorage.getItem("token"),
Authorization: "Bearer " + useAuthenticationUserStore().getToken,
},
})
.then((response) => {
+2 -1
View File
@@ -43,6 +43,7 @@
<script>
import axios from "axios";
import { useAuthenticationUserStore } from "@/store/modules/authentication";
export default {
data() {
@@ -61,7 +62,7 @@ export default {
axios
.get("/listcawlelongnext", {
headers: {
Authorization: "Bearer " + localStorage.getItem("token"),
Authorization: "Bearer " + useAuthenticationUserStore().getToken,
},
})
.then((response) => {
+2 -7
View File
@@ -48,7 +48,7 @@
<script>
import axios from "axios";
import { useAuthenticationUserStore } from "@/store/modules/authentication"
import { useAuthenticationUserStore } from "@/store/modules/authentication";
export default {
data() {
@@ -58,11 +58,6 @@ export default {
response: Array,
};
},
setup() {
const authenticationStore = useAuthenticationUserStore()
return { authenticationStore }
},
mounted: function () {
this.liveData();
},
@@ -72,7 +67,7 @@ export default {
axios
.get("/listcawlelongtoday", {
headers: {
Authorization: "Bearer " + this.authenticationStore.getToken,
Authorization: "Bearer " + useAuthenticationUserStore().getToken,
},
})
.then((response) => {