mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-09-11 14:36:35 +03:00
chore(analytics): added crawled url
This commit is contained in:
parent
00d7ec131c
commit
68a3b0bcef
@ -5,6 +5,8 @@ import { useCallback, useRef, useState } from "react";
|
|||||||
import { useSupabase } from "@/lib/context/SupabaseProvider";
|
import { useSupabase } from "@/lib/context/SupabaseProvider";
|
||||||
import { useAxios } from "@/lib/hooks";
|
import { useAxios } from "@/lib/hooks";
|
||||||
import { useToast } from "@/lib/hooks/useToast";
|
import { useToast } from "@/lib/hooks/useToast";
|
||||||
|
import { useEventTracking } from "@/services/analytics/useEventTracking";
|
||||||
|
|
||||||
|
|
||||||
import { isValidUrl } from "../helpers/isValidUrl";
|
import { isValidUrl } from "../helpers/isValidUrl";
|
||||||
|
|
||||||
@ -14,6 +16,8 @@ export const useCrawler = () => {
|
|||||||
const { session } = useSupabase();
|
const { session } = useSupabase();
|
||||||
const { publish } = useToast();
|
const { publish } = useToast();
|
||||||
const { axiosInstance } = useAxios();
|
const { axiosInstance } = useAxios();
|
||||||
|
const { track} = useEventTracking();
|
||||||
|
|
||||||
|
|
||||||
if (session === null) {
|
if (session === null) {
|
||||||
redirect("/login");
|
redirect("/login");
|
||||||
@ -25,6 +29,7 @@ export const useCrawler = () => {
|
|||||||
|
|
||||||
if (!url || !isValidUrl(url)) {
|
if (!url || !isValidUrl(url)) {
|
||||||
// Assuming you have a function to validate URLs
|
// Assuming you have a function to validate URLs
|
||||||
|
void track("URL_INVALID");
|
||||||
publish({
|
publish({
|
||||||
variant: "danger",
|
variant: "danger",
|
||||||
text: "Invalid URL",
|
text: "Invalid URL",
|
||||||
@ -43,6 +48,7 @@ export const useCrawler = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setCrawling(true);
|
setCrawling(true);
|
||||||
|
void track("URL_CRAWLED");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axiosInstance.post(`/crawl/`, config);
|
const response = await axiosInstance.post(`/crawl/`, config);
|
||||||
|
Loading…
Reference in New Issue
Block a user