Skip to content

Commit

Permalink
update locker table
Browse files Browse the repository at this point in the history
  • Loading branch information
birdpump committed Apr 14, 2024
1 parent 0abc0c8 commit fd0657c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/lib/services/admin/mainApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export async function fetchUserData(){

export async function fetchLockerData() {
try {
const response = await axios.get('https://locker-api.cvapps.net/admin/data/locker-data?page=1&pageSize=3');
const response = await axios.get('https://locker-api.cvapps.net/admin/data/locker-data?page=1&pageSize=3', {
withCredentials: true
});
return response.data;
} catch (error) {
throw error; // Rethrow the error to handle it elsewhere if needed
Expand Down
14 changes: 6 additions & 8 deletions src/routes/(admin)/admin/edit/views/LockerEdit.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@
}
];
let promise = Promise.resolve([]);
let showData = false;
onMount(async () => {
promise = await fetchLockerData();
data = await fetchLockerData();
showData = true;
});
</script>

Expand All @@ -109,17 +111,13 @@
<div class="modal-cont">
<Modal bind:showModal/>
</div>
{#await promise}
<p>...waiting</p>
{:then data}
{#if showData}
<Grid
{columns}
pagination={{ enabled: true, limit: 11 }}
search
{data}
{style}
/>
{:catch error}
<p style="color: red">{error.message}</p>
{/await}
{/if}
</div>

0 comments on commit fd0657c

Please sign in to comment.