Skip to content

Commit

Permalink
push update to complete the admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Rebs committed Nov 24, 2022
1 parent 346f115 commit bd55dd7
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions src/routes/admin/+page.svelte
Original file line number Diff line number Diff line change
@@ -60,11 +60,34 @@
} catch (e) {
error = e;
addUserCallCount += 1;
alert("Adding a user ran into an error :( do better -- the Mean Rice team");
alert("Adding a user ran into an error");
console.log("error in adding user",error);
return null;
}
}
let deleteUserCallCount = 0;
let deleteId: string;
async function deleteUser() {
let error = null;
try {
const res = await axios.delete(
`https://music-tonic.herokuapp.com/client1-rest/deleteUser?id=${deleteId}`
);
deleteUserCallCount += 1;
let deletedUser = res.data
console.log("deleted user is:", deletedUser);
return deletedUser;
} catch (e) {
error = e;
deleteUserCallCount += 1;
alert("Deleting a user ran into an error");
console.log("error in deleting user",error);
return null;
}
}
</script>

<h1 class="text-lg w-screen text-center mx-auto font-bold bg-gradient-to-r from-sky-500 to-indigo-500 background-animate py-2 text-white">Admin</h1>
@@ -102,21 +125,13 @@
<input class="border border-gray-400 indent-2" placeholder="Age" type="text" bind:value={userData.age}/>
</div>
</div>
<div>
{userData.realName}
{userData.userType}
{userData.mainGenre}
{userData.age}
{addUserCallCount}
</div>
</div>
<!--Delete User Block---------------------------------------------------------------------------------------------------->
<div class="px-4 py-2">
<SvelteButton buttonItem="Delete User" action={listUsers} />
<SvelteButton buttonItem="Delete User" action={deleteUser} />
<div class="px-4 py-2">
<form class="grid item-center">
<label>User ID</label>
<input class="border border-gray-400" type="text" />
<input class="border border-gray-400 indent-2" placeholder="User ID to Delete" type="text" bind:value={deleteId}/>
</form>
</div>
</div>

1 comment on commit bd55dd7

@vercel
Copy link

@vercel vercel bot commented on bd55dd7 Nov 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

mean-rice – ./

mean-rice.vercel.app
mean-rice-git-main-j-rebs.vercel.app
mean-rice-j-rebs.vercel.app

Please sign in to comment.