File tree Expand file tree Collapse file tree 5 files changed +8
-10
lines changed
Expand file tree Collapse file tree 5 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const isValidAuthContext = (ctx: any): ctx is AuthContext => {
1414
1515/**
1616 * Авторизация Github OAuth через firebase
17+ * @remark Стоит использовать только на странице Авторизации!!!
1718 */
1819function authGithub ( ) {
1920 const provider = new firebase . auth . GithubAuthProvider ( ) ;
Original file line number Diff line number Diff line change 1- export { default as Page } from "./page" ;
21export { default as User } from "./user" ;
32export * from "./consts" ;
43export * from "./hooks" ;
4+ export * from "./firebase" ;
File renamed without changes.
Original file line number Diff line number Diff line change @@ -2,11 +2,8 @@ import React from "react";
22import { GithubFilled } from "@ant-design/icons" ;
33import { Alert , Card } from "antd" ;
44import { alert } from "shared/helpers" ;
5- // !!! FIXME: это плохо( + loop imports
6- // eslint-disable-next-line import/order
7- import { useTitle } from "pages/helpers" ;
8- import { authorizeGithub } from "../firebase" ;
9- import { useAuth } from "../hooks" ;
5+ import { Auth } from "features" ;
6+ import { useTitle } from "../helpers" ;
107import "./index.scss" ;
118
129/**
@@ -17,15 +14,14 @@ import "./index.scss";
1714 * 1. Авторизация через Github (/authorize)
1815 * 2. Получение временного кода доступа
1916 * 3. Получение токена на основании OAuth данных и полученного кода
20- * !!! FIXME: move to pages level?
2117 */
2218const AuthPage = ( ) => {
2319 useTitle ( "Sign in to Github Client" ) ;
24- const { login } = useAuth ( ) ;
20+ const { login } = Auth . useAuth ( ) ;
2521
2622 // TODO: add ability to specify redirect url
2723 const authorize = ( ) => {
28- authorizeGithub ( )
24+ Auth . authorizeGithub ( )
2925 . then ( login )
3026 . catch ( ( err : Error ) => alert . error ( "Authorization error" , err . message ) ) ;
3127 } ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const HomePage = lazy(() => import("./home"));
66const RepositoryPage = lazy ( ( ) => import ( "./repository" ) ) ;
77const UserPage = lazy ( ( ) => import ( "./user" ) ) ;
88const SearchPage = lazy ( ( ) => import ( "./search" ) ) ;
9+ const AuthPage = lazy ( ( ) => import ( "./auth" ) ) ;
910
1011/**
1112 * Роутинг приложения
@@ -17,7 +18,7 @@ const Routing = () => {
1718 return (
1819 < Switch >
1920 < Route exact path = { Auth . routes . main } component = { HomePage } />
20- < Route exact path = { Auth . routes . login } component = { Auth . Page } />
21+ < Route exact path = { Auth . routes . login } component = { AuthPage } />
2122 < Redirect to = { Auth . routes . login } />
2223 </ Switch >
2324 ) ;
You can’t perform that action at this time.
0 commit comments