maybe this works now

This commit is contained in:
WaveringAna 2025-01-26 01:53:14 -05:00
parent f3a61bfa99
commit 5f1410fb2f
15 changed files with 472 additions and 15 deletions

View file

@ -1,5 +1,5 @@
import axios from 'axios';
import { CreateLinkRequest, Link, AuthResponse } from '../types/api';
import { CreateLinkRequest, Link, AuthResponse, ClickStats, SourceStats } from '../types/api';
// Create axios instance with default config
const api = axios.create({
@ -45,4 +45,16 @@ export const getAllLinks = async () => {
export const deleteLink = async (id: number) => {
await api.delete(`/links/${id}`);
};
};
export const getLinkClickStats = async (id: number) => {
const response = await api.get<ClickStats[]>(`/links/${id}/clicks`);
return response.data;
};
export const getLinkSourceStats = async (id: number) => {
const response = await api.get<SourceStats[]>(`/links/${id}/sources`);
return response.data;
};
export { api };