-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
61 lines (40 loc) · 1.36 KB
/
main.js
File metadata and controls
61 lines (40 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { header } from "./modules/header"
import { reloadEmptyTransactions, reloadEmptyWallet, reloadTransactions, reloadWallet } from "./modules/reload"
import { getData } from "./modules/http.requests"
import { user } from "./modules/user"
let name = document.querySelector("#name")
let email = document.querySelector("#email")
let myWallets = document.querySelector(".myWallets")
let tbody = document.querySelector("tbody")
name.innerHTML = user.name
email.innerHTML = user.email
let allWallets = document.querySelector("#allWallets")
let allPay = document.querySelector("#allPay")
header()
getData("/cards?user_id=" + user.id)
.then(res => {
if (res.status === 200 || res.status === 201) {
if (res.data.length) {
reloadWallet(res.data.slice(0, 4), myWallets)
} else {
reloadEmptyWallet(myWallets)
}
}
})
getData("/transactions?user_id=" + user.id)
.then(res => {
if (res.status === 200 || res.status === 201) {
if (res.data.length) {
reloadTransactions(res.data.slice(0, 7), tbody)
}
else{
reloadEmptyTransactions(tbody)
}
}
})
allWallets.onclick = () => {
location.assign("/pages/myWallet/")
}
allPay.onclick = () => {
location.assign("/pages/myTransaction/")
}