Compare commits
1 Commits
master
...
dogsitters
Author | SHA1 | Date | |
---|---|---|---|
271f7cab7d |
@ -1,35 +1,40 @@
|
||||
const router = require('express').Router();
|
||||
const router = require("express").Router();
|
||||
|
||||
router.get("/users", (request, response) => {
|
||||
response.send(require("./json/users/users.json"))
|
||||
})
|
||||
response.send(require("./json/users/users.json"));
|
||||
});
|
||||
|
||||
router.post("/auth", (request, response) => {
|
||||
const {phoneNumber, password} = request.body;
|
||||
console.log(phoneNumber, password);
|
||||
if (phoneNumber === '89999999999') {
|
||||
response.send(require("./json/auth/dogsitter.success.json"))
|
||||
}
|
||||
else if (phoneNumber === '89555555555') {
|
||||
response.status(400).send(require("./json/auth/error.json"))
|
||||
}
|
||||
else {
|
||||
response.send(require("./json/auth/owner.success.json"))
|
||||
}
|
||||
})
|
||||
const { phoneNumber, password } = request.body;
|
||||
console.log(phoneNumber, password);
|
||||
if (phoneNumber === "89999999999") {
|
||||
response.send(require("./json/auth/dogsitter.success.json"));
|
||||
} else if (phoneNumber === "89555555555") {
|
||||
response.status(400).send(require("./json/auth/error.json"));
|
||||
} else {
|
||||
response.send(require("./json/auth/owner.success.json"));
|
||||
}
|
||||
});
|
||||
|
||||
router.post("/auth/2fa", (request, response) => {
|
||||
const { code } = request.body;
|
||||
if (code === "0000") {
|
||||
response.send(require("./json/2fa/success.json"));
|
||||
} else {
|
||||
response.status(400).send(require("./json/2fa/error.json"));
|
||||
}
|
||||
});
|
||||
|
||||
router.post("/register", (request, response) => {
|
||||
const {firstName, secondName, phoneNumber, password, role} = request.body;
|
||||
console.log(phoneNumber, password, role);
|
||||
if (phoneNumber === '89283244141' || phoneNumber === '89872855893') {
|
||||
response.status(400).send(require("./json/register/error.json"))
|
||||
}
|
||||
else if (role === 'dogsitter') {
|
||||
response.send(require("./json/register/dogsitter.success.json"))
|
||||
}
|
||||
else {
|
||||
response.send(require("./json/register/owner.success.json"))
|
||||
}
|
||||
})
|
||||
const { firstName, secondName, phoneNumber, password, role } = request.body;
|
||||
console.log(phoneNumber, password, role);
|
||||
if (phoneNumber === "89283244141" || phoneNumber === "89872855893") {
|
||||
response.status(400).send(require("./json/register/error.json"));
|
||||
} else if (role === "dogsitter") {
|
||||
response.send(require("./json/register/dogsitter.success.json"));
|
||||
} else {
|
||||
response.send(require("./json/register/owner.success.json"));
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
4
server/routers/dogsitters-finder/json/2fa/error.json
Normal file
4
server/routers/dogsitters-finder/json/2fa/error.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"status": "error",
|
||||
"message": "Invalid code."
|
||||
}
|
4
server/routers/dogsitters-finder/json/2fa/success.json
Normal file
4
server/routers/dogsitters-finder/json/2fa/success.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"status": "success",
|
||||
"message": "Two-factor authentication passed."
|
||||
}
|
@ -24,30 +24,6 @@
|
||||
"old_price": 1100,
|
||||
"image": "new_game2",
|
||||
"os": "windows"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "The Witcher 3: Wild Hunt",
|
||||
"price": 990,
|
||||
"old_price": 1200,
|
||||
"image": "leaders_game4",
|
||||
"os": "windows"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Atomic Heart",
|
||||
"price": 1200,
|
||||
"old_price": 2500,
|
||||
"image": "leaders_game5",
|
||||
"os": "windows"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"title": "Crab Game",
|
||||
"price": 600,
|
||||
"old_price": 890,
|
||||
"image": "leaders_game6",
|
||||
"os": "windows"
|
||||
}
|
||||
],
|
||||
"games2": [
|
||||
@ -72,45 +48,21 @@
|
||||
"price": 1799,
|
||||
"image": "new_game3",
|
||||
"os": "windows"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "The Witcher 3: Wild Hunt",
|
||||
"price": 990,
|
||||
"old_price": 1200,
|
||||
"image": "leaders_game4",
|
||||
"os": "windows"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Atomic Heart",
|
||||
"price": 1200,
|
||||
"old_price": 2500,
|
||||
"image": "leaders_game5",
|
||||
"os": "windows"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"title": "Crab Game",
|
||||
"price": 600,
|
||||
"old_price": 890,
|
||||
"image": "leaders_game6",
|
||||
"os": "windows"
|
||||
}
|
||||
],
|
||||
"games3": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Elden Ring",
|
||||
"price": 3295,
|
||||
"old_price": 3599,
|
||||
"price": 990,
|
||||
"old_price": 1100,
|
||||
"image": "leaders_game2",
|
||||
"os": "windows"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Counter-Strike 2",
|
||||
"price": 479,
|
||||
"price": 279,
|
||||
"image": "leaders_game1",
|
||||
"os": "windows"
|
||||
},
|
||||
@ -120,7 +72,9 @@
|
||||
"price": 199,
|
||||
"image": "leaders_game3",
|
||||
"os": "windows"
|
||||
},
|
||||
}
|
||||
],
|
||||
"games4": [
|
||||
{
|
||||
"id": 4,
|
||||
"title": "The Witcher 3: Wild Hunt",
|
||||
|
Loading…
Reference in New Issue
Block a user