Compare commits
2 Commits
feature/fr
...
b70ac7c183
| Author | SHA1 | Date | |
|---|---|---|---|
| b70ac7c183 | |||
| 707c3be3ec |
24
server/routers/freetracker/auth/index.js
Normal file
24
server/routers/freetracker/auth/index.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
const Router = require('express').Router
|
||||||
|
|
||||||
|
const router = Router()
|
||||||
|
|
||||||
|
router.post('/auth/login', (req, res) => {
|
||||||
|
if (req.body.email === 'qwerty@mail.ru') {
|
||||||
|
res.status(200).send(require('./json/login/login-success.json'))
|
||||||
|
} else {
|
||||||
|
res.status(401).send(require('./json/login/login-error.json'));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
router.post('/auth/register', (req, res) => {
|
||||||
|
res.status(400).send(require('./json/registration/registration-error.json'))
|
||||||
|
// res.status(201).send(require('./json/registration/registration-error.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.post('/auth/reset-password', (req, res) => {
|
||||||
|
res.status(200).send(require('./json/reset-password/reset-password-success.json'))
|
||||||
|
// res.status(404).send(require('./json/reset-password/reset-password-error.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
11
server/routers/freetracker/auth/json/login/login-error.json
Normal file
11
server/routers/freetracker/auth/json/login/login-error.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"body": null,
|
||||||
|
"errors": [
|
||||||
|
{
|
||||||
|
"code": "AUTH_INVALID_CREDENTIALS",
|
||||||
|
"message": "Неверное имя пользователя или пароль"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"body": {
|
||||||
|
"token": "AUTH_TOKEN"
|
||||||
|
},
|
||||||
|
"errors": [],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"body": null,
|
||||||
|
"errors": [
|
||||||
|
{
|
||||||
|
"code": "REGISTRATION_EMAIL_TAKEN",
|
||||||
|
"message": "Электронная почта уже используется"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"body": {
|
||||||
|
"userId": "12345",
|
||||||
|
"token": "AUTH_TOKEN"
|
||||||
|
},
|
||||||
|
"errors": [],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"body": null,
|
||||||
|
"errors": [
|
||||||
|
{
|
||||||
|
"code": "RESET_PASSWORD_EMAIL_NOT_FOUND",
|
||||||
|
"message": "Адрес электронной почты не зарегистрирован"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"body": {
|
||||||
|
"message": "Отправлено электронное письмо для сброса пароля"
|
||||||
|
},
|
||||||
|
"errors": [],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
const router = require('express').Router();
|
const router = require('express').Router();
|
||||||
|
|
||||||
router.use('/performer', require('./dashboard-performer'))
|
router.use('/performer', require('./dashboard-performer'))
|
||||||
router.use('/landing', require('./landing'))
|
router.use('/auth', require('./auth'))
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
const Router = require('express').Router;
|
|
||||||
|
|
||||||
const router = Router()
|
|
||||||
|
|
||||||
const values = {
|
|
||||||
'blocks': 'success',
|
|
||||||
'application': 'success'
|
|
||||||
}
|
|
||||||
|
|
||||||
const timer = (_req, _res, next) => {
|
|
||||||
setTimeout(() => next(), 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
router.use(timer)
|
|
||||||
|
|
||||||
router.get(
|
|
||||||
'/blocks',
|
|
||||||
(req, res) =>
|
|
||||||
res.send(require(`./json/blocks-${values['blocks']}.json`))
|
|
||||||
)
|
|
||||||
|
|
||||||
router.post(
|
|
||||||
'/application',
|
|
||||||
(req, res) => {
|
|
||||||
res.send(require(`./json/application-${values['application']}.json`))
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
module.exports = router
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"success": false,
|
|
||||||
"body": { },
|
|
||||||
"errors": [
|
|
||||||
"Что-то пошло не так"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"success": true,
|
|
||||||
"body": { }
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"success": false,
|
|
||||||
"body": {
|
|
||||||
"blocks": []
|
|
||||||
},
|
|
||||||
"errors": [
|
|
||||||
"Что-то пошло не так"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"success": true,
|
|
||||||
"body": {
|
|
||||||
"blocks": [
|
|
||||||
{
|
|
||||||
"titleKey":"block1.title",
|
|
||||||
"textKey":"block1.subtitle",
|
|
||||||
"imageName":"truck1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"titleKey":"block2.title",
|
|
||||||
"textKey":"block2.subtitle",
|
|
||||||
"imageName":"truck2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"titleKey":"block3.title",
|
|
||||||
"textKey":"block3.subtitle",
|
|
||||||
"imageName":"truck3"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user