Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: linting, testing, building
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
branches: [ master ]
jobs:
pipeline:
runs-on: ubuntu-latest
Expand Down
9 changes: 9 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

if [ "$GIT_BRANCH" = "master" ]; then
npm run lint:ts
npm run lint:scss
npm run test:unit
npm run test:ui
fi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_pages_AboutPage_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_pages_MainPage_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_pages_NotFoundPage_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_shared_Button_Outline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_shared_Button_Outline_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_shared_Button_Primary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_shared_ThemeSwitcher_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_widget_ErrorPage_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_widget_ErrorPage_Light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_widget_Navbar_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_widget_Navbar_Light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_iphone7_widget_Sidebar_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .loki/reference/chrome_laptop_pages_AboutPage_Dark.png
Binary file modified .loki/reference/chrome_laptop_pages_MainPage_Dark.png
Binary file modified .loki/reference/chrome_laptop_pages_NotFoundPage_Dark.png
Binary file modified .loki/reference/chrome_laptop_shared_Button_Outline.png
Binary file modified .loki/reference/chrome_laptop_shared_Button_Outline_Dark.png
Binary file modified .loki/reference/chrome_laptop_shared_Button_Primary.png
Binary file modified .loki/reference/chrome_laptop_shared_ThemeSwitcher_Dark.png
Binary file modified .loki/reference/chrome_laptop_widget_ErrorPage_Dark.png
Binary file modified .loki/reference/chrome_laptop_widget_ErrorPage_Light.png
Binary file modified .loki/reference/chrome_laptop_widget_Navbar_Dark.png
Binary file modified .loki/reference/chrome_laptop_widget_Navbar_Light.png
Binary file modified .loki/reference/chrome_laptop_widget_Sidebar_Dark.png
3 changes: 3 additions & 0 deletions extractedTranslations/en/translation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"throw error": "throw error",
"Введите username": "Введите username",
"Введите пароль": "Введите пароль",
"Войти": "",
"Войти": "Войти",
"Главная": "Главная",
"Главная страница": "Главная страница",
Expand Down
3 changes: 3 additions & 0 deletions extractedTranslations/ru/translation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"throw error": "throw error",
"Введите username": "Введите username",
"Введите пароль": "Введите пароль",
"Войти": "Войти",
"Войти": "Войти",
"Главная": "Главная",
"Главная страница": "Главная страница",
Expand Down
12 changes: 12 additions & 0 deletions json-server/db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"posts": [
{"id": 1, "title": "json-server", "author": "typicode"}
],
"comments": [
{"id": 1, "body": "some comment", "postId": 1}
],
"users": [
{"id": 1, "username": "admin", "password": "123"}
],
"profile": { "name": "typicode" }
}
58 changes: 58 additions & 0 deletions json-server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* eslint-disable no-console */
const fs = require('fs');
const jsonServer = require('json-server');
const path = require('path');

const server = jsonServer.create();

const router = jsonServer.router(path.resolve(__dirname, 'db.json'));

server.use(jsonServer.defaults({}));
server.use(jsonServer.bodyParser);

// Нужно для небольшой задержки, чтобы запрос проходил не мгновенно, имитация реального апи
server.use(async (req, res, next) => {
await new Promise((res) => {
setTimeout(res, 800);
});
next();
});

// Эндпоинт для логина
server.post('/login', (req, res) => {
try {
const { username, password } = req.body;
const db = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'db.json'), 'UTF-8'));
const { users = [] } = db;

const userFromBd = users.find(
(user) => user.username === username && user.password === password,
);

if (userFromBd) {
return res.json(userFromBd);
}

return res.status(403).json({ message: 'User not found' });
} catch (e) {
console.log(e);
return res.status(500).json({ message: e.message });
}
});

// проверяем, авторизован ли пользователь
// eslint-disable-next-line
server.use((req, res, next) => {
if (!req.headers.authorization) {
return res.status(403).json({ message: 'AUTH ERROR' });
}

next();
});

server.use(router);

// запуск сервера
server.listen(8000, () => {
console.log('server is running on 8000 port');
});
Loading
Loading