Make timetrackAccounts load async
Update a package
This commit is contained in:
parent
4131213723
commit
bc88c632be
6
frontend/package-lock.json
generated
6
frontend/package-lock.json
generated
@ -5852,9 +5852,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"elliptic": {
|
"elliptic": {
|
||||||
"version": "6.5.2",
|
"version": "6.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
|
||||||
"integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
|
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"bn.js": "^4.4.0",
|
"bn.js": "^4.4.0",
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import {BASE_URI} from "../../globals.js";
|
import {BASE_URI} from "../../globals.js";
|
||||||
import TimeTrackAccountItem from "./TimeTrackAccountItem.vue";
|
import TimeTrackAccountItem from "./TimeTrackAccountItem.vue";
|
||||||
|
import axios from "axios"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TimeTrackAccounts",
|
name: "TimeTrackAccounts",
|
||||||
@ -35,50 +36,31 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
deleteTimeTrackAccount(selfLink) {
|
async deleteTimeTrackAccount(selfLink) {
|
||||||
var accountxhttp = new XMLHttpRequest();
|
try {
|
||||||
accountxhttp.onreadystatechange = function () {
|
await axios.delete(selfLink)
|
||||||
if (this.readyState == 4 && this.status == 204) {
|
this.timeTrackAccounts = this.timeTrackAccounts.filter(account => account._links.self.href !== selfLink)
|
||||||
location.reload();
|
} catch (e) {
|
||||||
|
alert(e)
|
||||||
}
|
}
|
||||||
};
|
|
||||||
accountxhttp.open("DELETE", selfLink, false);
|
|
||||||
accountxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
|
||||||
accountxhttp.send(null);
|
|
||||||
},
|
},
|
||||||
editTimeTrackAccount(selfLink) {
|
editTimeTrackAccount(selfLink) {
|
||||||
sessionStorage.setItem("timeTrackAccountEditSelfLink", selfLink);
|
sessionStorage.setItem("timeTrackAccountEditSelfLink", selfLink);
|
||||||
this.$router.push("/edittimetrackaccount");
|
this.$router.push("/edittimetrackaccount")
|
||||||
},
|
},
|
||||||
createTimeTrackAccount() {
|
createTimeTrackAccount() {
|
||||||
this.$router.push("/createtimetrackaccount");
|
this.$router.push("/createtimetrackaccount")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async mounted() {
|
||||||
created() {
|
let accountsResponse = await axios.get(
|
||||||
var accounts;
|
BASE_URI
|
||||||
var timeTrackAccountsTMP;
|
+ "/accounts/search/findByUsername?username="
|
||||||
var accountxhttp = new XMLHttpRequest();
|
+ sessionStorage.getItem("username")
|
||||||
accountxhttp.onreadystatechange = function () {
|
)
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
this.timeTrackAccounts = accountsResponse.data._embedded.accounts
|
||||||
accounts = JSON.parse(accountxhttp.responseText);
|
|
||||||
timeTrackAccountsTMP = accounts._embedded.accounts;
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
accountxhttp.open(
|
|
||||||
"GET",
|
|
||||||
BASE_URI +
|
|
||||||
"/accounts/search/findByUsername?username=" +
|
|
||||||
sessionStorage.getItem("timeTrackAccountListUser"),
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
accountxhttp.setRequestHeader("Authorization", sessionStorage.getItem("jwt"));
|
|
||||||
accountxhttp.send(null);
|
|
||||||
|
|
||||||
this.timeTrackAccounts = timeTrackAccountsTMP;
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
Loading…
Reference in New Issue
Block a user