Skip to content

Commit

Permalink
fix deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
adamfadrian committed Mar 31, 2023
1 parent c5a049d commit 94803d2
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 93 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_CLIENT_ID = 662763246096-rl72bml8fl957n8k1af9p0q3htev1gs4.apps.googleusercontent.com
VITE_CLIENT_SECRET = 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
VITE_CLIENT_ID = 753409996346-gnuv4ksqbtdjgarlr43fbjpu5v5ijfgn.apps.googleusercontent.com
VITE_CLIENT_SECRET = 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
1 change: 1 addition & 0 deletions public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function App() {
<GoogleOAuthProvider clientId={`${import.meta.env.VITE_CLIENT_ID}`}>
<BrowserRouter>
<Routes>
<Route path="/login" element={checkToken ? <Home /> : <Login />} />
<Route path="/" element={<Home />} />
<Route path="/login" element={<Login />} />
<Route path="/register" element={<Register />} />
<Route path="/" element={<Home />} />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const Navbar: React.FC<NavbarProps> = ({ name, email, handleProfile, children, i

const handleNavigate = () => {
if (!cookies.token) {
navigate('/')
navigate('/login')
} else {
navigate('/cart')
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProdukCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const ProdukCard: React.FC<ListingProps> = ({

const onClick = () => {
if(!cookie.token){
navigate('/')
navigate('/login')
} else {
navigate(`/detail/${id}`)
}
Expand Down
7 changes: 5 additions & 2 deletions src/pages/Cart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,11 @@ const Cart: React.FC<CartData> = ({ products }) => {
<div className="block md:w-[600px] lg:w-[500px] 2xl:w-[600px] mx-auto space-y-5 p-6 bg-white border border-gray-200 rounded-lg shadow dark:bg-slate-800 dark:border-lapak dark:shadow-lg dark:shadow-slate-600">
<h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Keranjang</h5>

{cart === null || undefined || "" || 502 ?
<p className='text-[20px] text-center underline-offset-8 underline decoration-zinc-400 dark:decoration-slate-50 py-20 text-zinc-600 font-semibold dark:text-zinc-50'> Keranjang anda masih kosong </p>
{cart.length === 0 ?
<>
<p className='text-[20px] text-center underline-offset-8 underline decoration-zinc-400 dark:decoration-slate-50 py-20 text-zinc-600 font-semibold dark:text-zinc-50'> Keranjang anda masih kosong </p>
<button className="btn btn-primary mx-auto bg-lapak hover:bg-lapak hover:translate-x-2 border-none" onClick={() => navigate('/')}>Beli Product? </button>
</>
:
<div className="flex flex-col dark:text-white">
<thead>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ const Detail = () => {
// });
// });

diskusi.map((i) => console.log(i))
// diskusi.map((i) => console.log(i))

return (
<Layout>
Expand Down
6 changes: 5 additions & 1 deletion src/pages/HistoryPembeli.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const HistoryPembeli = () => {
}
})
.catch((err) => {
console.log(err.response.data)
console.log(err)
})
.finally(() => setLoading(false))
}
Expand Down Expand Up @@ -262,6 +262,8 @@ const HistoryPembeli = () => {

<Modal isOpen={showProduk} size='w-[40vw]' isClose={() => setShowProduk(false)} title="Detail Transaki" >
<form className="p-5">
{combineProduk ?
<>
{combineProduk.map((item) => (
<CardHistory
id={item.id}
Expand All @@ -277,6 +279,8 @@ const HistoryPembeli = () => {
handleFeedback={() => setShowFeedback(true)}
/>
))}
</> : <></>
}
</form>
</Modal>

Expand Down
49 changes: 25 additions & 24 deletions src/pages/HomeFilterPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,7 @@ const HomeFilter = () => {
console.log("products",res.data.data)
setProducts(res.data.data)
setCategoryId('')
if(res.data.data === null){
Swal.fire({
title: 'Maaf!',
text: 'Barang yang anda cari mungkin belum tersedia',
imageUrl: `${sowwy}`,
confirmButtonText: "Oke",
confirmButtonColor: "#31CFB9",
reverseButtons: true,
imageWidth: 400,
imageHeight: 200,
imageAlt: 'Custom image',
}).then((willReFetch)=>{
if (willReFetch.isConfirmed) {
setFormValues({
minprice: 0,
maxprice: 0,
minrating: 0,
kategori: ''
})
fetchProduct('', '', '', '')
}
})
}


} catch (error) {

Expand All @@ -136,10 +114,33 @@ const HomeFilter = () => {
try {
const res = await axios.get(categoryEndpoint,{
headers:{
Authorization: `Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Miwicm9sZSI6InVzZXIiLCJleHAiOjE2Nzk5MTc2MjN9.K8lerhsq124A_-y4Lf8gNAPIJtLe9xRUMLKjN_tWIZA`
Authorization: `Bearer ${cookie.token}`
}
})
setCategory(res.data.data)
if(res.data.data === null){
Swal.fire({
title: 'Maaf!',
text: 'Barang yang anda cari mungkin belum tersedia',
imageUrl: `${sowwy}`,
confirmButtonText: "Oke",
confirmButtonColor: "#31CFB9",
reverseButtons: true,
imageWidth: 400,
imageHeight: 200,
imageAlt: 'Custom image',
}).then((willReFetch)=>{
if (willReFetch.isConfirmed) {
setFormValues({
minprice: 0,
maxprice: 0,
minrating: 0,
kategori: ''
})
fetchProduct('', '', '', '')
}
})
}
} catch (error) {

}
Expand Down
120 changes: 60 additions & 60 deletions src/pages/NotifikasiCoba.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,67 +5,67 @@
// import { DataType } from "../utils/types/DataType";

// const NotifikasiCoba = () => {
// // const [data, setData] = useState<string[]>([]);

// // useEffect(() => {
// // let currentOffset = 0;

// // const loadData = () => {
// // axios
// // .get(`https://lapakumkm.mindd.site/products`)
// // .then(({ data }) => {
// // const datas = data.data.slice(currentOffset, currentOffset + 10)
// // .map((p: any) => p.product_name);
// // setData((i) => [...i, ...datas]);
// // currentOffset += 10;
// // });
// // };

// // const handleScroll = (e: any) => {
// // console.log(e.target.documentElement.scrollHeight)
// // console.log(e.target.documentElement.scrollTop)
// // const scrollHeight = e.target.documentElement.scrollHeight;
// // const currentHeight = Math.ceil(
// // e.target.documentElement.scrollTop + window.innerHeight
// // );
// // if (currentHeight + 1 >= scrollHeight) {
// // loadData();
// // }
// // };

// // loadData();
// // window.addEventListener("scroll", handleScroll);

// // return () => {
// // window.removeEventListener("scroll", handleScroll);
// // };
// // }, []);

// // data.map((i) => console.log(i))
// const [data, setData] = useState<string[]>([]);

// useEffect(() => {
// let currentOffset = 0;

// const loadData = () => {
// axios
// .get(`https://lapakumkm.mindd.site/products`)
// .then(({ data }) => {
// const datas = data.data.slice(currentOffset, currentOffset + 10)
// .map((p: any) => p.product_name);
// setData((i) => [...i, ...datas]);
// currentOffset += 10;
// });
// };

// const handleScroll = (e: any) => {
// console.log(e.target.documentElement.scrollHeight)
// console.log(e.target.documentElement.scrollTop)
// const scrollHeight = e.target.documentElement.scrollHeight;
// const currentHeight = Math.ceil(
// e.target.documentElement.scrollTop + window.innerHeight
// );
// if (currentHeight + 1 >= scrollHeight) {
// loadData();
// }
// };

// // return (
// // <div
// // className="flex
// // flex-col items-center
// // justify-center min-h-screen py-2
// // bg-gray-900 text-gray-200"
// // >
// // <div className="flex flex-col text-4xl font-bold items-center justify-center w-full px-20 text-center">
// // {data.map((p, i) => {
// // return (
// // <div
// // key={i}
// // className="border w-80 h-40 flex justify-around place-items-center"
// // >
// // <div>{i + 1}.</div>
// // <div>{p}</div>
// // </div>
// // );
// // })}
// // </div>
// // </div>
// // );
// // }
// loadData();
// window.addEventListener("scroll", handleScroll);

// return () => {
// window.removeEventListener("scroll", handleScroll);
// };
// }, []);

// data.map((i) => console.log(i))

// return (
// <div
// className="flex
// flex-col items-center
// justify-center min-h-screen py-2
// bg-gray-900 text-gray-200"
// >
// <div className="flex flex-col text-4xl font-bold items-center justify-center w-full px-20 text-center">
// {data.map((p, i) => {
// return (
// <div
// key={i}
// className="border w-80 h-40 flex justify-around place-items-center"
// >
// <div>{i + 1}.</div>
// <div>{p}</div>
// </div>
// );
// })}
// </div>
// </div>
// );
// }

// const [data, setData] = useState<DataType[]>([])
// const [hasMore, setHasMore] = useState<boolean>(true)
Expand Down

0 comments on commit 94803d2

Please sign in to comment.