This commit is contained in:
2024-10-01 19:30:04 +05:00
parent 4dde4b357a
commit a902773452
2 changed files with 47 additions and 7 deletions

View File

@@ -1,3 +1,47 @@
async function postData(url, data) {
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
if (response.ok) {
const result = await response.json();
} else {
console.error();
Nova.error('Error: ' + response.status + ' ' + response.statusText)
}
} catch (error) {
Nova.error('Error: ' + error.message)
}
}
async function fetchCardHistory() {
let cardHistoryDetailContainer = document.getElementById('card-history-details');
postData('/fetch-card-history')
.then(response => {
if (response.errCode != 0) {
Nova.error('Barlap bolmady, tor näsazlygy')
}
cardHistoryDetailContainer.innerHTML = `
<p>Şahamça: <strong>${response.depName}</strong></p>
<p>
<ul>
${Array.from(response.transactions).map(transaction => {
return 'hello';
})}
</ul>
</p>
`;
})
}
// window.LaravelNovaWizardStore = {
// data: {
// steps: 0,
@@ -166,10 +210,3 @@
// // when app is booting
// Nova.booting((app, store) => {})
async function fetchCardHistory() {
let response = await fetch('/fetch-card-history');
let data = await response.json();
console.log(data)
}

View File

@@ -44,4 +44,7 @@
<div class="expiry-date text-white">{{ $resource->card_month }}/{{ $resource->card_year }}</div>
</div>
</div>
<div id="card-history-details">
</div>
</div>