Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added redirections after logging in or out #253

Merged
Changes from 1 commit
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
Prev Previous commit
added redirections after logging in or out
Smilinko committed Dec 8, 2023
commit 507113d7f1afc17d9ac2c73ae3cc08dbfb2bebb1
8 changes: 4 additions & 4 deletions src/components/PageLayout/Authentication/Authentication.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Link from 'next/link'
import {useRouter} from 'next/router'
import {FC, useState} from 'react'

import {AuthContainer} from '@/utils/AuthContainer'
@@ -7,7 +8,6 @@ import {useSeminarInfo} from '@/utils/useSeminarInfo'
import {Overlay} from '../../Overlay/Overlay'
import {LoginForm} from '../LoginForm/LoginForm'
import styles from './Authentication.module.scss'
import { useRouter } from 'next/router'

export const Authentication: FC = () => {
const [displayAuthenticationOverlay, setDisplayAuthenticationOverlay] = useState(false)
@@ -19,12 +19,12 @@ export const Authentication: FC = () => {

const {seminar} = useSeminarInfo()

const router = useRouter()
const router = useRouter()

const redirectLogout = () => {
logout()
if (router.asPath.endsWith("profil") || router.asPath.endsWith("profil/uprava")) {
router.push("/")
if (router.asPath.endsWith('profil') || router.asPath.endsWith('profil/uprava')) {
router.push('/')
}
}

8 changes: 4 additions & 4 deletions src/components/PageLayout/LoginForm/LoginForm.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {useRouter} from 'next/router'
import {FC} from 'react'
import {SubmitHandler, useForm} from 'react-hook-form'

import {Button} from '@/components/Clickable/Clickable'
import styles from '@/components/FormItems/Form.module.scss'
import {FormInput} from '@/components/FormItems/FormInput/FormInput'
import {AuthContainer} from '@/utils/AuthContainer'
import { useRouter } from 'next/router'

type LoginFormValues = {
email: string
@@ -25,12 +25,12 @@ export const LoginForm: FC<ILoginForm> = ({closeOverlay}) => {
const {login} = AuthContainer.useContainer()
const {handleSubmit, control} = useForm<LoginFormValues>({defaultValues})

const router = useRouter()
const router = useRouter()

const redirectClose = () => {
closeOverlay()
if (router.asPath.endsWith("registracia")) {
router.push("/")
if (router.asPath.endsWith('registracia')) {
router.push('/')
}
}


Unchanged files with check annotations Beta

import styles from './StromLogo.module.scss'
const handleClick = (e: MouseEvent<HTMLElement>) => {

Check warning on line 5 in src/components/PageLayout/StromLogo/StromLogo.tsx

GitHub Actions / branch-test

'e' is defined but never used. Allowed unused args must match /^_/u
console.log('Clicked')

Check warning on line 6 in src/components/PageLayout/StromLogo/StromLogo.tsx

GitHub Actions / branch-test

Unexpected console statement
}
export const StromLogo: FC = () => {
invalidateSeriesQuery()
alert('Riešenie úspešne nahrané.')
} else {
console.warn(response)

Check warning on line 37 in src/components/Problems/UploadProblemForm.tsx

GitHub Actions / branch-test

Unexpected console statement
alert(
'Niečo sa ASI pokazilo, skontroluj, či bolo riešenie nahrané, a ak si technický typ, môžeš pozrieť chybu v konzole.',
)