Merge branch 'dev' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/suitable
This commit is contained in:
commit
4a7051fdd1
@ -1,23 +0,0 @@
|
|||||||
import { NextResponse } from 'next/server'
|
|
||||||
import { prisma } from '@/libs/prisma'
|
|
||||||
|
|
||||||
export async function POST(request: Request) {
|
|
||||||
try {
|
|
||||||
const body = await request.json()
|
|
||||||
const { username, email, password } = body
|
|
||||||
|
|
||||||
const user = await prisma.user.create({
|
|
||||||
data: {
|
|
||||||
username,
|
|
||||||
email,
|
|
||||||
password,
|
|
||||||
updated_at: new Date(),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
return NextResponse.json(user)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error creating user:', error)
|
|
||||||
return NextResponse.json({ error: 'Error creating user' }, { status: 500 })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { NextResponse } from 'next/server'
|
|
||||||
import { prisma } from '@/libs/prisma'
|
|
||||||
|
|
||||||
export const GET = async () => {
|
|
||||||
const users = await prisma.user.findMany()
|
|
||||||
return NextResponse.json(users)
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
import { NextResponse } from 'next/server'
|
|
||||||
import { prisma } from '@/libs/prisma'
|
|
||||||
import { getIronSession } from 'iron-session'
|
|
||||||
import { cookies } from 'next/headers'
|
|
||||||
import { sessionOptions } from '@/libs/session'
|
|
||||||
import type { SessionData } from '@/types/Auth'
|
|
||||||
|
|
||||||
export async function POST(request: Request) {
|
|
||||||
const { username, password } = await request.json()
|
|
||||||
|
|
||||||
console.log('🚀 ~ POST ~ username:', username)
|
|
||||||
console.log('🚀 ~ POST ~ password:', password)
|
|
||||||
|
|
||||||
const user = await prisma.user.findFirst({
|
|
||||||
where: {
|
|
||||||
username: username,
|
|
||||||
password: password,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
console.log('🚀 ~ POST ~ user:', user)
|
|
||||||
|
|
||||||
if (!user) {
|
|
||||||
return NextResponse.json({ error: 'User not found' }, { status: 404 })
|
|
||||||
}
|
|
||||||
|
|
||||||
const cookieStore = await cookies()
|
|
||||||
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
|
||||||
console.log('start session edit!')
|
|
||||||
// session.username = user.username!
|
|
||||||
// session.email = user.email!
|
|
||||||
session.isLoggedIn = true
|
|
||||||
console.log('end session edit!')
|
|
||||||
await session.save()
|
|
||||||
console.log('🚀 ~ POST ~ session:', session)
|
|
||||||
|
|
||||||
// return NextResponse.redirect(new URL(process.env.NEXT_PUBLIC_URL!, request.url))
|
|
||||||
return NextResponse.json(user)
|
|
||||||
}
|
|
||||||
@ -35,7 +35,7 @@ export default function DownloadPdf() {
|
|||||||
<>
|
<>
|
||||||
<button onClick={handleDownPdf}>down</button>
|
<button onClick={handleDownPdf}>down</button>
|
||||||
<div ref={targetRef} style={{ boxSizing: 'border-box' }}>
|
<div ref={targetRef} style={{ boxSizing: 'border-box' }}>
|
||||||
<div style={{ margin: '0 auto', padding: 0, maxWidth: '800px' }}>
|
<div style={{ margin: '0 auto', padding: 0, maxWidth: '800px', minWidth: '800px' }}>
|
||||||
<div style={{ padding: '20px 20px 50px', borderBottom: '2px solid #2E3A59' }}>
|
<div style={{ padding: '20px 20px 50px', borderBottom: '2px solid #2E3A59' }}>
|
||||||
<div style={{ float: 'left', verticalAlign: 'middle', fontSize: '18px', color: '#101010', fontWeight: 600, fontFamily: 'M-Gothic' }}>
|
<div style={{ float: 'left', verticalAlign: 'middle', fontSize: '18px', color: '#101010', fontWeight: 600, fontFamily: 'M-Gothic' }}>
|
||||||
HWJ 現地調査シート1/2
|
HWJ 現地調査シート1/2
|
||||||
|
|||||||
@ -29,12 +29,6 @@ export default function EdgeProvider({ children, sessionData }: EdgeProviderProp
|
|||||||
const { setAlertMsg, setAlertBtn, setAlert, setAlert2, setAlert2BtnYes, setAlert2BtnNo } = usePopupController()
|
const { setAlertMsg, setAlertBtn, setAlert, setAlert2, setAlert2BtnYes, setAlert2BtnNo } = usePopupController()
|
||||||
const { session, setSession } = useSessionStore()
|
const { session, setSession } = useSessionStore()
|
||||||
|
|
||||||
if (pathname === '/login') {
|
|
||||||
if (session?.isLoggedIn) {
|
|
||||||
router.push('/')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 사용자 이벤트 트래킹 처리
|
* 사용자 이벤트 트래킹 처리
|
||||||
*
|
*
|
||||||
@ -72,6 +66,11 @@ export default function EdgeProvider({ children, sessionData }: EdgeProviderProp
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (pathname === '/login') {
|
||||||
|
if (session?.isLoggedIn) {
|
||||||
|
router.push('/')
|
||||||
|
}
|
||||||
|
}
|
||||||
//alert 함수 변경해서 바인딩
|
//alert 함수 변경해서 바인딩
|
||||||
window.alert = function (msg, alertBtn = () => setAlert(false)) {
|
window.alert = function (msg, alertBtn = () => setAlert(false)) {
|
||||||
alertFunc(msg, alertBtn)
|
alertFunc(msg, alertBtn)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user