Skip to content

Commit

Permalink
more name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LoV432 committed Nov 3, 2023
1 parent ef18bda commit 6cded58
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/api/edit/device-type/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function POST(request: Request) {
}
let userID = existingMacAddress.id;
let updateDevice = db
.prepare('UPDATE users SET deviceType = ? WHERE id = ?')
.prepare('UPDATE users SET device_type = ? WHERE id = ?')
.run(body.deviceType, userID);
return new Response(JSON.stringify(updateDevice), {
status: 200
Expand Down
12 changes: 6 additions & 6 deletions app/api/edit/display-name/route.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { db } from '@/lib/db';
import { userReturnType } from '../../dhcp-event/route';

type display_nameType = {
type displayNameType = {
macAddress: string;
display_name: string;
displayName: string;
};
export async function POST(request: Request) {
const body = (await request.json()) as display_nameType;
const body = (await request.json()) as displayNameType;

if (
!body.macAddress ||
body.macAddress === '' ||
!body.display_name ||
body.display_name === ''
!body.displayName ||
body.displayName === ''
) {
return new Response(JSON.stringify({ error: 'Missing required fields' }), {
status: 400
Expand All @@ -33,7 +33,7 @@ export async function POST(request: Request) {
let userID = existingMacAddress.id;
let updateDisplayName = db
.prepare('UPDATE users SET display_name = ? WHERE id = ?')
.run(body.display_name, userID);
.run(body.displayName, userID);
return new Response(JSON.stringify(updateDisplayName), {
status: 200
});
Expand Down
10 changes: 5 additions & 5 deletions app/components/user-cards/UserCard.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function UserCard({ user }: { user: userReturnType }) {
<figure className="relative flex w-1/4 items-center justify-center overflow-visible px-1 py-4">
<DropDown
mac_address={user.mac_address}
deviceType={user.device_type}
device_type={user.device_type}
/>
</figure>
<div className="card-body w-2/3 p-4">
Expand Down Expand Up @@ -85,10 +85,10 @@ function UserSpeed({ ip }: { ip: string }) {

function DropDown({
mac_address,
deviceType
device_type
}: {
mac_address: string;
deviceType: string;
device_type: string;
}) {
const [dropDownIsOpen, SetDropDownIsOpen] = useState(false);
const [macAddress] = useState(mac_address);
Expand All @@ -115,7 +115,7 @@ function DropDown({
className="btn m-0 h-fit w-full border-none bg-transparent p-0 hover:bg-transparent active:bg-transparent"
>
<Image
src={`/${deviceType}.svg`}
src={`/${device_type}.svg`}
alt="Android Icon"
width={25}
height={25}
Expand Down Expand Up @@ -205,7 +205,7 @@ function NameChangePopUp({
fetch(`/api/edit/display-name`, {
body: JSON.stringify({
macAddress: macAddress,
display_name: newName
displayName: newName
}),
method: 'POST'
});
Expand Down

0 comments on commit 6cded58

Please sign in to comment.