Skip to content

Commit

Permalink
fix build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AureliusIvan committed Apr 8, 2024
1 parent 70aa420 commit 587ad14
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 23 deletions.
16 changes: 1 addition & 15 deletions client/src/app/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use client'
'use server'
import { BellRing, Check } from "lucide-react"
import { Button } from "@/components/ui/button"
import {
Expand All @@ -17,28 +17,14 @@ import { LoginButton } from './part/login.button'
import React, { useState } from 'react'


// Login <Pa></Pa>ge
export default async function LoginPage() {
// submit
async function submit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault()
const data = {
email: '[email protected]',
password: '12345678'
}
const response = await AuthService.login(data.email, data.password) as any
// console.log(response)
}

return (
<main>
<section
className='flex flex-col items-center justify-center h-screen gap-4'
>
<form
onSubmit={submit}
// action={'/api/login'}
// method='post'
>
<Card className={cn("w-[380px]")}>
<CardHeader>
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function Post() {
<section
className='grid grid-cols-3 gap-4'
>
{data.data.map((post: any) => (
{data?.data?.map((post: any) => (
<PostCard key={post._id}
title={post.title}
post={post}
Expand Down
8 changes: 4 additions & 4 deletions client/src/services/post.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ const END_POINT = process.env.SERVER_ENDPOINT;

const PostService = {
getAll: async () => {
// const response = await axios.get('/api/post/get');
const response = await fetch(`${END_POINT}/api/post/get`, {
const response = await fetch(END_POINT + `/api/post/get`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
next: {
revalidate: 3600
revalidate: 1,
}
})
.then(response => response.json())
.then(data => data)
.catch(error => console.error(error))
// .catch(error => console.error(error))
// console.log(response)
return response;
},
get: async (id: string) => {
Expand Down
6 changes: 3 additions & 3 deletions src/config/aws-s3.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ dotenv.config()

const S3Config = new S3Client({
region: "apac", // this is the region that you select in AWS account
endpoint: process.env.R2_ENDPOINT,
endpoint: process.env.S3_ENDPOINT,
credentials: {
accessKeyId: process.env.R2_ACCESS_KEY, // store it in .env file to keep it safe
secretAccessKey: process.env.R2_SECRET_KEY
accessKeyId: process.env.S3_ACCESS_KEY, // store it in .env file to keep it safe
secretAccessKey: process.env.S3_SECRET_KEY
}
})

Expand Down
1 change: 1 addition & 0 deletions src/middleware/file.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const uploadFileMiddlwareS3 = (fieldname: string) => (req: Request, res: Respons

// Validate file types and sizes
files.forEach((file: any) => {
// log file
const allowedTypes = ['image/jpeg', 'image/png', 'image/svg', 'image/webp'];
const maxSize = 5 * 1024 * 1024; // 5MB

Expand Down

0 comments on commit 587ad14

Please sign in to comment.