mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: login redirect
This commit is contained in:
1
.env
1
.env
@@ -57,7 +57,6 @@ JWT_PASSPHRASE=827c9f8cce8bb82e75b2aec4a14a61f572ac28c7a8531f08dcdf1652573a7049
|
||||
LOCK_DSN=flock
|
||||
###< symfony/lock ###
|
||||
|
||||
OAUTH_AUTHORIZATION_URL=
|
||||
OAUTH_CLIENT_ID=
|
||||
OAUTH_CLIENT_SECRET=
|
||||
OAUTH_AUTHORIZATION_URL=
|
||||
|
||||
@@ -59,7 +59,7 @@ export default function App() {
|
||||
useEffect(() => {
|
||||
getUser().then(() => {
|
||||
setIsAuthenticated(true)
|
||||
if (location.pathname === '/login') navigate('/search/domain')
|
||||
if (location.pathname === '/login') navigate('/home')
|
||||
}).catch(() => {
|
||||
setIsAuthenticated(false)
|
||||
navigate('/home')
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
import {Card, Divider, Popconfirm, Typography} from "antd";
|
||||
import {Card, Divider, Popconfirm, theme, Typography} from "antd";
|
||||
import {t} from "ttag";
|
||||
import {DeleteFilled} from "@ant-design/icons";
|
||||
import React from "react";
|
||||
import {Connector, deleteConnector} from "../../utils/api/connectors";
|
||||
|
||||
const {useToken} = theme;
|
||||
|
||||
|
||||
type ConnectorElement = Connector & { id: string }
|
||||
|
||||
export function ConnectorsList({connectors, onDelete}: { connectors: ConnectorElement[], onDelete: () => void }) {
|
||||
const {token} = useToken()
|
||||
|
||||
return <>
|
||||
{connectors.map(connector =>
|
||||
<>
|
||||
@@ -16,7 +21,7 @@ export function ConnectorsList({connectors, onDelete}: { connectors: ConnectorEl
|
||||
onConfirm={() => deleteConnector(connector.id).then(onDelete)}
|
||||
okText={t`Yes`}
|
||||
cancelText={t`No`}
|
||||
><DeleteFilled/> </Popconfirm>}>
|
||||
><DeleteFilled style={{color: token.colorError}}/></Popconfirm>}>
|
||||
<Typography.Paragraph>
|
||||
{t`Provider`} : {connector.provider}
|
||||
</Typography.Paragraph>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, {createContext, useContext, useState} from "react";
|
||||
import React, {createContext, useContext, useEffect, useState} from "react";
|
||||
import {Alert, Button, Card, Flex, Form, Input} from "antd";
|
||||
import {login} from "../utils/api";
|
||||
import {getUser, login} from "../utils/api";
|
||||
import {useNavigate} from "react-router-dom";
|
||||
import {t} from 'ttag'
|
||||
|
||||
@@ -11,7 +11,7 @@ type FieldType = {
|
||||
|
||||
export const AuthenticatedContext = createContext<any>(null)
|
||||
|
||||
export default function Page() {
|
||||
export default function LoginPage() {
|
||||
|
||||
const [error, setError] = useState()
|
||||
const navigate = useNavigate()
|
||||
@@ -27,6 +27,13 @@ export default function Page() {
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getUser().then(() => {
|
||||
setIsAuthenticated(true)
|
||||
navigate('/home')
|
||||
})
|
||||
}, [])
|
||||
|
||||
return <Flex gap="middle" align="center" justify="center" vertical><Card
|
||||
title={t`Log in`}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user