mirror of
https://github.com/r-ca/kidshift-be.git
synced 2024-10-25 16:14:02 +00:00
暫定でchildIdをログイン時に返すように
This commit is contained in:
parent
80461ecb17
commit
00a26892b5
|
@ -9,8 +9,8 @@ router.post('/login', (req: Request, res: Response) => {
|
|||
if (!loginCode) {
|
||||
return res.status(400).json({ message: 'ログインコードが指定されていません' });
|
||||
}
|
||||
login(loginCode).then((token) => {
|
||||
res.status(200).json({ accessToken: token });
|
||||
login(loginCode).then(resp => {
|
||||
res.status(200).json(resp);
|
||||
}).catch((err) => {
|
||||
res.status(500).json({ message: 'ログインに失敗しました', detail: err });
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import prisma from '@src/prisma';
|
||||
import { issueTokenByChildId } from '@src/utils/tokenUtils';
|
||||
|
||||
async function login(loginCode: string): Promise<string | null> {
|
||||
async function login(loginCode: string): Promise<any> { // Workaround
|
||||
const childId: string | null = await prisma.activeLoginCode.findUnique({
|
||||
where: {
|
||||
code: parseInt(loginCode)
|
||||
|
@ -20,7 +20,10 @@ async function login(loginCode: string): Promise<string | null> {
|
|||
code: parseInt(loginCode)
|
||||
}
|
||||
});
|
||||
return await issueTokenByChildId(childId);
|
||||
return {
|
||||
accessToken: issueTokenByChildId(childId),
|
||||
childId: childId
|
||||
};
|
||||
}
|
||||
|
||||
export { login };
|
||||
|
|
Loading…
Reference in New Issue
Block a user