import { useToast } from "../components/ui/use-toast.ts";
import { useLocation } from "react-router-dom";
import { ToastAction } from "../components/ui/toast.tsx";
import { login, tokenField } from "../conf.ts";
import { useEffect } from "react";
import Loader from "../components/Loader.tsx";
import "../assets/auth.less";
import axios from "axios";
import { validateToken } from "../store/auth.ts";
import { useDispatch } from "react-redux";
import router from "../router.ts";
import { useTranslation } from "react-i18next";
function Auth() {
const { toast } = useToast();
const { t } = useTranslation();
const dispatch = useDispatch();
const search = new URLSearchParams(useLocation().search);
const token = (search.get(tokenField) || "").trim();
if (!token.length) {
toast({
title: t("invalid-token"),
description: t("invalid-token-prompt"),
action: (