This commit is contained in:
2024-01-22 20:40:23 +05:00
parent 29148afe9c
commit c9e8de4d83
22 changed files with 498 additions and 500 deletions
+2 -2
View File
@@ -310,7 +310,7 @@ function DashboardPage() {
<div className="left flex flex-col w-full">
<div className="flex bg-[#F0F1F2] ">
<button
onClick={() => alert("Чё тыкаешь? В разработке еще!!")}
onClick={() => alert("В разработке")}
className="p-3 transition-colors hover:bg-neutral-200"
>
<BurgerIcon />
@@ -446,7 +446,7 @@ function DashboardPage() {
</div>
</div>
<div className="right w-[320px] flex flex-col">
<div className="right w-[384px] flex flex-col">
<div className="min-h-[48px] bg-[#F0F1F2] flex justify-between items-center">
<p className="text-xs font-semibold px-3 text-green-600">
{company?.name}
+15 -1
View File
@@ -1,7 +1,21 @@
import { Link } from "react-router-dom";
/* eslint-disable react-hooks/exhaustive-deps */
import { Link, useNavigate } from "react-router-dom";
import Button from "../components/Button";
import { useEffect } from "react";
import useAuthStore from "../stores/useAuthStore";
function HomePage() {
const accessToken = useAuthStore().accessToken;
const navigate = useNavigate();
useEffect(() => {
if (accessToken) {
navigate("/dashboard");
} else {
navigate("/login");
}
}, []);
return (
<div className="p-8 flex flex-col gap-4 w-fit">
<p>HomePage</p>
+10 -2
View File
@@ -1,5 +1,6 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import ky from "ky";
import ReCAPTCHA from "react-google-recaptcha";
import Form from "../components/Form";
@@ -13,7 +14,8 @@ function LoginPage() {
const [username, setUsername] = useState<string>();
const [password, setPassword] = useState<string>();
const recaptchaRef = useRef(null);
const [setAccessToken, setUser] = useAuthStore((state) => [
const [accessToken, setAccessToken, setUser] = useAuthStore((state) => [
state.accessToken,
state.setAccessToken,
state.setUser,
]);
@@ -46,6 +48,12 @@ function LoginPage() {
}, 3000);
}
useEffect(() => {
if (accessToken) {
navigate("/dashboard");
}
}, []);
return (
<div className="min-h-screen flex flex-col justify-center items-center p-8 flex-1 ">
<div className=" bg-white rounded-lg shadow-md overflow-hidden">