Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hw87AlenBolatov
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Болатов Ален
hw87AlenBolatov
Commits
a412de03
Commit
a412de03
authored
Mar 22, 2023
by
Болатов Ален
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#5
89 создание функционала логина
parent
b7f75be4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
user.ts
backend/src/controllers/user.ts
+8
-9
No files found.
backend/src/controllers/user.ts
View file @
a412de03
import
{
Request
,
Response
}
from
'express'
;
import
{
getErrorMessage
}
from
'../utils/errors.util'
;
import
*
as
userServices
from
'../services/user'
;
// import {CustomRequest} from '../middleware/auth';
//
export const loginOne = async (req: Request, res: Response) => {
//
try {
//
const foundUser = await userServices.login(req.body);
//
res.status(200).send(foundUser);
//
} catch (error) {
//
return res.status(500).send(getErrorMessage(error));
//
}
//
};
export
const
loginOne
=
async
(
req
:
Request
,
res
:
Response
)
=>
{
try
{
const
foundUser
=
await
userServices
.
login
(
req
.
body
);
res
.
status
(
200
).
send
(
foundUser
);
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
getErrorMessage
(
error
));
}
};
export
const
registerOne
=
async
(
req
:
Request
,
res
:
Response
)
=>
{
try
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment