refactor(frontend): Remove '/api' prefix from all API calls to align with backend URL convention

- Updated all API endpoint strings in 'frontend/src' (via sed and manual fixes) to remove the '/api/' prefix.
- Manually fixed 'Timeline.tsx' absolute URLs to use the 'api' subdomain and correct path.
- Manually fixed 'useAuth.ts' logout fetch URLs.
- Updated 'HelpApiDocs.tsx' sandbox URL.
- This change, combined with the backend URL update, fully transitions the application to use subdomain-based routing (e.g., 'http://api.lvh.me:8000/resource/') instead of path-prefix routing (e.g., 'http://api.lvh.me:8000/api/resource/').
This commit is contained in:
poduck
2025-12-01 02:14:17 -05:00
parent 92724d03b6
commit b3e2c1f324
19 changed files with 92 additions and 82 deletions

View File

@@ -99,7 +99,7 @@ const Tasks: React.FC = () => {
const { data: scheduledTasks = [], isLoading: tasksLoading } = useQuery<ScheduledTask[]>({
queryKey: ['scheduled-tasks'],
queryFn: async () => {
const { data } = await axios.get('/api/scheduled-tasks/');
const { data } = await axios.get('/scheduled-tasks/');
return data;
},
});
@@ -108,7 +108,7 @@ const Tasks: React.FC = () => {
const { data: eventAutomations = [], isLoading: automationsLoading } = useQuery<GlobalEventPlugin[]>({
queryKey: ['global-event-plugins'],
queryFn: async () => {
const { data } = await axios.get('/api/global-event-plugins/');
const { data } = await axios.get('/global-event-plugins/');
return data;
},
});
@@ -129,7 +129,7 @@ const Tasks: React.FC = () => {
// Delete task
const deleteMutation = useMutation({
mutationFn: async (taskId: string) => {
await axios.delete(`/api/scheduled-tasks/${taskId}/`);
await axios.delete(`/scheduled-tasks/${taskId}/`);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['scheduled-tasks'] });
@@ -143,7 +143,7 @@ const Tasks: React.FC = () => {
// Toggle task active status
const toggleActiveMutation = useMutation({
mutationFn: async ({ taskId, status }: { taskId: string; status: 'ACTIVE' | 'PAUSED' }) => {
await axios.patch(`/api/scheduled-tasks/${taskId}/`, { status });
await axios.patch(`/scheduled-tasks/${taskId}/`, { status });
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['scheduled-tasks'] });
@@ -157,7 +157,7 @@ const Tasks: React.FC = () => {
// Trigger task manually
const triggerMutation = useMutation({
mutationFn: async (taskId: string) => {
await axios.post(`/api/scheduled-tasks/${taskId}/trigger/`);
await axios.post(`/scheduled-tasks/${taskId}/trigger/`);
},
onSuccess: () => {
toast.success('Task triggered successfully');
@@ -170,7 +170,7 @@ const Tasks: React.FC = () => {
// Delete event automation
const deleteEventAutomationMutation = useMutation({
mutationFn: async (automationId: string) => {
await axios.delete(`/api/global-event-plugins/${automationId}/`);
await axios.delete(`/global-event-plugins/${automationId}/`);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['global-event-plugins'] });
@@ -184,7 +184,7 @@ const Tasks: React.FC = () => {
// Toggle event automation active status
const toggleEventAutomationMutation = useMutation({
mutationFn: async (automationId: string) => {
await axios.post(`/api/global-event-plugins/${automationId}/toggle/`);
await axios.post(`/global-event-plugins/${automationId}/toggle/`);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['global-event-plugins'] });
@@ -198,7 +198,7 @@ const Tasks: React.FC = () => {
// Update event automation
const updateEventAutomationMutation = useMutation({
mutationFn: async ({ id, data }: { id: string; data: Partial<GlobalEventPlugin> }) => {
await axios.patch(`/api/global-event-plugins/${id}/`, data);
await axios.patch(`/global-event-plugins/${id}/`, data);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['global-event-plugins'] });