Move some files to ui/helpers dir
This commit is contained in:
parent
95c174d3a5
commit
a8ec5db9dc
|
@ -8,7 +8,7 @@ import { useQuery, gql } from '@apollo/client'
|
|||
import { Authorized } from './components/routes/AuthorizedRoute'
|
||||
import { Helmet } from 'react-helmet'
|
||||
import Header from './components/header/Header'
|
||||
import { authToken } from './authentication'
|
||||
import { authToken } from './helpers/authentication'
|
||||
|
||||
export const ADMIN_QUERY = gql`
|
||||
query adminQuery {
|
||||
|
|
|
@ -7,9 +7,9 @@ import { render, screen } from '@testing-library/react'
|
|||
import Layout, { ADMIN_QUERY, MAPBOX_QUERY, SideMenu } from './Layout'
|
||||
import { MemoryRouter } from 'react-router-dom'
|
||||
|
||||
import * as authentication from './authentication'
|
||||
import * as authentication from './helpers/authentication'
|
||||
|
||||
jest.mock('./authentication.js')
|
||||
jest.mock('./helpers/authentication.js')
|
||||
|
||||
test('Layout component', async () => {
|
||||
render(
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Button, Form, Message, Header } from 'semantic-ui-react'
|
|||
import { Container } from './loginUtilities'
|
||||
|
||||
import { checkInitialSetupQuery, login } from './loginUtilities'
|
||||
import { authToken } from '../../authentication'
|
||||
import { authToken } from '../../helpers/authentication'
|
||||
|
||||
const initialSetupMutation = gql`
|
||||
mutation InitialSetup(
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Redirect } from 'react-router-dom'
|
|||
import styled from 'styled-components'
|
||||
import { Button, Form, Message, Header } from 'semantic-ui-react'
|
||||
import { checkInitialSetupQuery, login, Container } from './loginUtilities'
|
||||
import { authToken } from '../../authentication'
|
||||
import { authToken } from '../../helpers/authentication'
|
||||
|
||||
import logoPath from '../../assets/photoview-logo.svg'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { gql } from '@apollo/client'
|
||||
import { saveTokenCookie } from '../../authentication'
|
||||
import { saveTokenCookie } from '../../helpers/authentication'
|
||||
import styled from 'styled-components'
|
||||
import { Container as SemanticContainer } from 'semantic-ui-react'
|
||||
|
||||
|
|
|
@ -5,7 +5,10 @@ import { Route, Switch } from 'react-router-dom'
|
|||
import RouterProps from 'react-router-prop-types'
|
||||
import { Form, Header, Icon, Input, Message } from 'semantic-ui-react'
|
||||
import styled from 'styled-components'
|
||||
import { getSharePassword, saveSharePassword } from '../../authentication'
|
||||
import {
|
||||
getSharePassword,
|
||||
saveSharePassword,
|
||||
} from '../../helpers/authentication'
|
||||
import AlbumSharePage from './AlbumSharePage'
|
||||
import MediaSharePage from './MediaSharePage'
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { onError } from '@apollo/client/link/error'
|
|||
import { WebSocketLink } from '@apollo/client/link/ws'
|
||||
|
||||
import urlJoin from 'url-join'
|
||||
import { clearTokenCookie } from './authentication'
|
||||
import { clearTokenCookie } from './helpers/authentication'
|
||||
import { MessageState } from './components/messages/Messages'
|
||||
|
||||
export const GRAPHQL_ENDPOINT = process.env.PHOTOVIEW_API_ENDPOINT
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react'
|
||||
import { authToken } from '../authentication'
|
||||
import { authToken } from '../helpers/authentication'
|
||||
import { Checkbox, Dropdown, Button, Icon } from 'semantic-ui-react'
|
||||
import styled from 'styled-components'
|
||||
import PropTypes from 'prop-types'
|
||||
|
|
|
@ -7,7 +7,7 @@ import { Icon } from 'semantic-ui-react'
|
|||
import { SidebarContext } from './sidebar/Sidebar'
|
||||
import AlbumSidebar from './sidebar/AlbumSidebar'
|
||||
import { useLazyQuery, gql } from '@apollo/client'
|
||||
import { authToken } from '../authentication'
|
||||
import { authToken } from '../helpers/authentication'
|
||||
|
||||
const Header = styled.h1`
|
||||
margin: 24px 0 8px 0 !important;
|
||||
|
|
|
@ -3,7 +3,7 @@ import styled from 'styled-components'
|
|||
import SearchBar from './Searchbar'
|
||||
|
||||
import logoPath from '../../assets/photoview-logo.svg'
|
||||
import { authToken } from '../../authentication'
|
||||
import { authToken } from '../../helpers/authentication'
|
||||
|
||||
const Container = styled.div`
|
||||
height: 60px;
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect } from 'react'
|
|||
import PropTypes from 'prop-types'
|
||||
import styled from 'styled-components'
|
||||
import { useLazyQuery, gql } from '@apollo/client'
|
||||
import debounce from '../../debounce'
|
||||
import debounce from '../../helpers/debounce'
|
||||
import { ProtectedImage } from '../photoGallery/ProtectedMedia'
|
||||
import { NavLink } from 'react-router-dom'
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { useState } from 'react'
|
|||
import { animated, useTransition } from 'react-spring'
|
||||
import { Message } from 'semantic-ui-react'
|
||||
import styled from 'styled-components'
|
||||
import { authToken } from '../../authentication'
|
||||
import { authToken } from '../../helpers/authentication'
|
||||
import MessageProgress from './MessageProgress'
|
||||
import SubscriptionsHook from './SubscriptionsHook'
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import PropTypes from 'prop-types'
|
||||
import { useEffect } from 'react'
|
||||
import { useSubscription, gql } from '@apollo/client'
|
||||
import { authToken } from '../../authentication'
|
||||
import { authToken } from '../../helpers/authentication'
|
||||
|
||||
const notificationSubscription = gql`
|
||||
subscription notificationSubscription {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useState, useRef, useEffect } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import styled from 'styled-components'
|
||||
import debounce from '../../../debounce'
|
||||
import debounce from '../../../helpers/debounce'
|
||||
|
||||
import ExitIcon from './icons/Exit'
|
||||
import NextIcon from './icons/Next'
|
||||
|
|
|
@ -2,7 +2,7 @@ import React from 'react'
|
|||
import PropTypes from 'prop-types'
|
||||
import { Route, Redirect } from 'react-router-dom'
|
||||
import { useQuery, gql } from '@apollo/client'
|
||||
import { authToken } from '../../authentication'
|
||||
import { authToken } from '../../helpers/authentication'
|
||||
|
||||
export const ADMIN_QUERY = gql`
|
||||
query adminQuery {
|
||||
|
|
|
@ -5,9 +5,9 @@ import AuthorizedRoute from './AuthorizedRoute'
|
|||
import { render, screen } from '@testing-library/react'
|
||||
import { MemoryRouter, Route } from 'react-router-dom'
|
||||
|
||||
import * as authentication from '../../authentication'
|
||||
import * as authentication from '../../helpers/authentication'
|
||||
|
||||
jest.mock('../../authentication.js')
|
||||
jest.mock('../../helpers/authentication.js')
|
||||
|
||||
describe('AuthorizedRoute component', () => {
|
||||
const AuthorizedComponent = () => <div>authorized content</div>
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Route, Switch, Redirect } from 'react-router-dom'
|
|||
|
||||
import { Loader } from 'semantic-ui-react'
|
||||
import Layout from '../../Layout'
|
||||
import { clearTokenCookie } from '../../authentication'
|
||||
import { clearTokenCookie } from '../../helpers/authentication'
|
||||
|
||||
const AuthorizedRoute = React.lazy(() => import('./AuthorizedRoute'))
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import PropTypes from 'prop-types'
|
|||
import React, { useEffect } from 'react'
|
||||
import { useLazyQuery, gql } from '@apollo/client'
|
||||
import styled from 'styled-components'
|
||||
import { authToken } from '../../authentication'
|
||||
import { authToken } from '../../helpers/authentication'
|
||||
import { ProtectedImage, ProtectedVideo } from '../photoGallery/ProtectedMedia'
|
||||
import SidebarShare from './Sharing'
|
||||
import SidebarDownload from './SidebarDownload'
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
Icon,
|
||||
} from 'semantic-ui-react'
|
||||
import copy from 'copy-to-clipboard'
|
||||
import { authToken } from '../../authentication'
|
||||
import { authToken } from '../../helpers/authentication'
|
||||
import styled from 'styled-components'
|
||||
|
||||
const sharePhotoQuery = gql`
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Table } from 'semantic-ui-react'
|
|||
import styled from 'styled-components'
|
||||
import { MessageState } from '../messages/Messages'
|
||||
import { useLazyQuery, gql } from '@apollo/client'
|
||||
import { authToken } from '../../authentication'
|
||||
import { authToken } from '../../helpers/authentication'
|
||||
|
||||
export const SIDEBAR_DOWNLOAD_QUERY = gql`
|
||||
query sidebarDownloadQuery($mediaId: ID!) {
|
||||
|
|
Loading…
Reference in New Issue