Code Monkey home page Code Monkey logo

e-commerce-app's Introduction

e-commerce-app's People

Contributors

kyzsuukii avatar

Stargazers

Bruno Wego avatar  avatar

Watchers

 avatar

e-commerce-app's Issues

Frontend: menampilkan detail product yang di upload

Menampikan detail product yang baru di tambahkan ke database
commit perubahan: commit 0b80852c9fc1b15dd2b74f5611263816a5bc2c60

dan dikarenakan commit nya beberapa hari yang lalu jadi kode mungkin berubah jadi untuk lebih detail silahkan check

https://github.com/kyzsuukii/e-commerce-app/blob/dashboard-dev/src/routes/_admin/dashboard/products.tsx

https://github.com/kyzsuukii/e-commerce-app/blob/dashboard-dev/src/routes/_admin/dashboard/product.$productId.tsx

Frontend: form untuk mengupdate product

penambahan form input untuk mengupdate informasi produk di database seperti:

  • Nama produk
  • Category Produk
  • Deskripsi produk
  • Harga produk
  • Stok produk

Untuk fitur penggantian thumbnail gambar produk belum didukung, namun sedang dalam proses pengembangan (Work in Progress).

perubahan secara lebih detail silahkan check di sini: Commit 9df5068ab5dde84d9a18ef26a7b3091897cf673d.

dan beberapa commit perubahan di bagian frontend hari ini: https://github.com/kyzsuukii/e-commerce-app/commits/dashboard-dev/?since=2024-04-06&until=2024-04-06

Frontend: Menganti role

Menu action menganti role user

1cfef03

<DropdownMenuItem
onClick={() => updateRole(row.original.id, "ADMIN")}
>
ADMIN
</DropdownMenuItem>

<DropdownMenuItem
onClick={() => updateRole(row.original.id, "CUSTOMER")}
>
CUSTOMER
</DropdownMenuItem>

async function updateRole(id: number, role: string) {
try {
const { data, status } = await axios.patch(
`${config.SERVER_API_URL}/v1/user/role`,
{
id,
role,
},
{
headers: {
Authorization: `Bearer ${localStorage.getItem("session")}`,
},
}
);
if (status === 200) {
return toast.success(data.msg, {
action: {
label: "refresh",
onClick: () => window.location.reload(),
},
});
}
} catch (error: unknown) {
if (error instanceof AxiosError) {
if (error.response?.status == 401) {
localStorage.clear();
window.location.reload();
}
return toast.error(error.response?.data.errors[0].msg);
} else {
return toast.error("An unexpected error occurred");
}
}
}

Frontend: Menghapus user

Menu action menghapus user

cd45c44

<DropdownMenuItem onClick={() => deleteUser(row.original.id)}>
<span className="text-red-600">Delete</span>
</DropdownMenuItem>

async function deleteUser(id: number) {
try {
const { status, data } = await axios.delete(
`${config.SERVER_API_URL}/v1/user/delete`,
{
data: {
id,
},
headers: {
Authorization: `Bearer ${localStorage.getItem("session")}`,
},
}
);
if (status === 200) {
return toast.success(data.msg, {
action: {
label: "refresh",
onClick: () => window.location.reload(),
},
});
}
} catch (error: unknown) {
if (error instanceof AxiosError) {
if (error.response?.status == 401) {
localStorage.clear();
window.location.reload();
}
return toast.error(error.response?.data.errors[0].msg);
} else {
return toast.error("An unexpected error occurred");
}
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.