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:
@@ -252,9 +252,10 @@ const AppContent: React.FC = () => {
|
||||
const isRootDomainForUnauthUser = currentHostname === baseDomain || currentHostname === 'localhost';
|
||||
|
||||
if (!isRootDomainForUnauthUser) {
|
||||
// Redirect to root domain login
|
||||
// Redirect to root domain login (preserve port)
|
||||
const protocol = window.location.protocol;
|
||||
window.location.href = `${protocol}//${baseDomain}/login`;
|
||||
const port = window.location.port ? `:${window.location.port}` : '';
|
||||
window.location.href = `${protocol}//${baseDomain}${port}/login`;
|
||||
return <LoadingScreen />;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ const CreateTaskModal: React.FC<CreateTaskModalProps> = ({ isOpen, onClose, onSu
|
||||
const { data: plugins = [], isLoading: pluginsLoading } = useQuery<PluginInstallation[]>({
|
||||
queryKey: ['plugin-installations'],
|
||||
queryFn: async () => {
|
||||
const { data } = await axios.get('/api/plugin-installations/');
|
||||
const { data } = await axios.get('/plugin-installations/');
|
||||
// Filter out plugins that already have scheduled tasks
|
||||
return data.filter((p: PluginInstallation) => !p.scheduled_task);
|
||||
},
|
||||
@@ -209,7 +209,7 @@ const CreateTaskModal: React.FC<CreateTaskModalProps> = ({ isOpen, onClose, onSu
|
||||
apply_to_existing: applyToExisting,
|
||||
};
|
||||
|
||||
await axios.post('/api/global-event-plugins/', payload);
|
||||
await axios.post('/global-event-plugins/', payload);
|
||||
queryClient.invalidateQueries({ queryKey: ['global-event-plugins'] });
|
||||
toast.success(applyToExisting ? 'Plugin attached to all events' : 'Plugin will apply to future events');
|
||||
} else {
|
||||
@@ -240,7 +240,7 @@ const CreateTaskModal: React.FC<CreateTaskModalProps> = ({ isOpen, onClose, onSu
|
||||
}
|
||||
}
|
||||
|
||||
await axios.post('/api/scheduled-tasks/', payload);
|
||||
await axios.post('/scheduled-tasks/', payload);
|
||||
toast.success('Scheduled task created');
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ export function DevQuickLogin({ embedded = false }: DevQuickLoginProps) {
|
||||
setLoading(user.username);
|
||||
try {
|
||||
// Call token auth API
|
||||
const response = await apiClient.post('/api/auth-token/', {
|
||||
const response = await apiClient.post('/auth-token/', {
|
||||
username: user.username,
|
||||
password: user.password,
|
||||
});
|
||||
@@ -98,7 +98,7 @@ export function DevQuickLogin({ embedded = false }: DevQuickLoginProps) {
|
||||
setCookie('access_token', response.data.token, 7);
|
||||
|
||||
// Fetch user data to determine redirect
|
||||
const userResponse = await apiClient.get('/api/auth/me/');
|
||||
const userResponse = await apiClient.get('/auth/me/');
|
||||
const userData = userResponse.data;
|
||||
|
||||
// Determine the correct subdomain based on user role
|
||||
|
||||
@@ -167,7 +167,7 @@ const EditTaskModal: React.FC<EditTaskModalProps> = ({ task, isOpen, onClose, on
|
||||
}
|
||||
}
|
||||
|
||||
await axios.patch(`/api/scheduled-tasks/${task.id}/`, payload);
|
||||
await axios.patch(`/scheduled-tasks/${task.id}/`, payload);
|
||||
onSuccess();
|
||||
handleClose();
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -49,7 +49,7 @@ const EmailTemplateForm: React.FC<EmailTemplateFormProps> = ({
|
||||
const { data: variablesData } = useQuery<{ variables: EmailTemplateVariableGroup[] }>({
|
||||
queryKey: ['email-template-variables'],
|
||||
queryFn: async () => {
|
||||
const { data } = await api.get('/api/email-templates/variables/');
|
||||
const { data } = await api.get('/email-templates/variables/');
|
||||
return data;
|
||||
},
|
||||
});
|
||||
@@ -57,7 +57,7 @@ const EmailTemplateForm: React.FC<EmailTemplateFormProps> = ({
|
||||
// Preview mutation
|
||||
const previewMutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
const { data } = await api.post('/api/email-templates/preview/', {
|
||||
const { data } = await api.post('/email-templates/preview/', {
|
||||
subject,
|
||||
html_content: htmlContent,
|
||||
text_content: textContent,
|
||||
@@ -80,10 +80,10 @@ const EmailTemplateForm: React.FC<EmailTemplateFormProps> = ({
|
||||
};
|
||||
|
||||
if (isEditing && template) {
|
||||
const { data } = await api.patch(`/api/email-templates/${template.id}/`, payload);
|
||||
const { data } = await api.patch(`/email-templates/${template.id}/`, payload);
|
||||
return data;
|
||||
} else {
|
||||
const { data } = await api.post('/api/email-templates/', payload);
|
||||
const { data } = await api.post('/email-templates/', payload);
|
||||
return data;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -32,7 +32,7 @@ const EmailTemplateSelector: React.FC<EmailTemplateSelectorProps> = ({
|
||||
queryFn: async () => {
|
||||
const params = new URLSearchParams();
|
||||
if (category) params.append('category', category);
|
||||
const { data } = await api.get(`/api/email-templates/?${params.toString()}`);
|
||||
const { data } = await api.get(`/email-templates/?${params.toString()}`);
|
||||
return data.map((t: any) => ({
|
||||
id: String(t.id),
|
||||
name: t.name,
|
||||
|
||||
@@ -72,7 +72,7 @@ const EventAutomations: React.FC<EventAutomationsProps> = ({ eventId, compact =
|
||||
const { data: plugins = [] } = useQuery<PluginInstallation[]>({
|
||||
queryKey: ['plugin-installations'],
|
||||
queryFn: async () => {
|
||||
const { data } = await axios.get('/api/plugin-installations/');
|
||||
const { data } = await axios.get('/plugin-installations/');
|
||||
return data;
|
||||
},
|
||||
});
|
||||
@@ -81,7 +81,7 @@ const EventAutomations: React.FC<EventAutomationsProps> = ({ eventId, compact =
|
||||
const { data: eventPlugins = [], isLoading } = useQuery<EventPlugin[]>({
|
||||
queryKey: ['event-plugins', eventId],
|
||||
queryFn: async () => {
|
||||
const { data } = await axios.get(`/api/event-plugins/?event_id=${eventId}`);
|
||||
const { data } = await axios.get(`/event-plugins/?event_id=${eventId}`);
|
||||
return data;
|
||||
},
|
||||
enabled: !!eventId,
|
||||
@@ -90,7 +90,7 @@ const EventAutomations: React.FC<EventAutomationsProps> = ({ eventId, compact =
|
||||
// Add plugin mutation
|
||||
const addMutation = useMutation({
|
||||
mutationFn: async (data: { plugin_installation: string; trigger: string; offset_minutes: number }) => {
|
||||
return axios.post('/api/event-plugins/', {
|
||||
return axios.post('/event-plugins/', {
|
||||
event: eventId,
|
||||
...data,
|
||||
});
|
||||
@@ -111,7 +111,7 @@ const EventAutomations: React.FC<EventAutomationsProps> = ({ eventId, compact =
|
||||
// Toggle mutation
|
||||
const toggleMutation = useMutation({
|
||||
mutationFn: async (pluginId: string) => {
|
||||
return axios.post(`/api/event-plugins/${pluginId}/toggle/`);
|
||||
return axios.post(`/event-plugins/${pluginId}/toggle/`);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['event-plugins', eventId] });
|
||||
@@ -121,7 +121,7 @@ const EventAutomations: React.FC<EventAutomationsProps> = ({ eventId, compact =
|
||||
// Delete mutation
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: async (pluginId: string) => {
|
||||
return axios.delete(`/api/event-plugins/${pluginId}/`);
|
||||
return axios.delete(`/event-plugins/${pluginId}/`);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['event-plugins', eventId] });
|
||||
|
||||
@@ -39,7 +39,7 @@ export const Timeline: React.FC = () => {
|
||||
const { data: resources = [] } = useQuery({
|
||||
queryKey: ['resources'],
|
||||
queryFn: async () => {
|
||||
const response = await axios.get('http://lvh.me:8000/api/resources/');
|
||||
const response = await axios.get('http://api.lvh.me:8000/resources/');
|
||||
return adaptResources(response.data);
|
||||
}
|
||||
});
|
||||
@@ -47,7 +47,7 @@ export const Timeline: React.FC = () => {
|
||||
const { data: backendAppointments = [] } = useQuery({ // Renamed to backendAppointments to avoid conflict with localEvents
|
||||
queryKey: ['appointments'],
|
||||
queryFn: async () => {
|
||||
const response = await axios.get('http://lvh.me:8000/api/appointments/');
|
||||
const response = await axios.get('http://api.lvh.me:8000/appointments/');
|
||||
return response.data; // Still return raw data, adapt in useEffect
|
||||
}
|
||||
});
|
||||
|
||||
@@ -95,8 +95,11 @@ export const useLogout = () => {
|
||||
queryClient.removeQueries({ queryKey: ['currentUser'] });
|
||||
queryClient.clear();
|
||||
|
||||
// Redirect to login page
|
||||
window.location.href = '/login';
|
||||
// Redirect to login page on root domain
|
||||
const protocol = window.location.protocol;
|
||||
const baseDomain = getBaseDomain();
|
||||
const port = window.location.port ? `:${window.location.port}` : '';
|
||||
window.location.href = `${protocol}//${baseDomain}${port}/login`;
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -150,7 +153,7 @@ export const useMasquerade = () => {
|
||||
// Call logout API to clear HttpOnly sessionid cookie
|
||||
try {
|
||||
const apiUrl = import.meta.env.VITE_API_URL || `${window.location.protocol}//${baseDomain}`;
|
||||
await fetch(`${apiUrl}/api/auth/logout/`, {
|
||||
await fetch(`${apiUrl}/auth/logout/`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
});
|
||||
@@ -222,7 +225,7 @@ export const useStopMasquerade = () => {
|
||||
// CRITICAL: Clear the session cookie BEFORE redirect
|
||||
try {
|
||||
const apiUrl = import.meta.env.VITE_API_URL || `${window.location.protocol}//${baseDomain}`;
|
||||
await fetch(`${apiUrl}/api/auth/logout/`, {
|
||||
await fetch(`${apiUrl}/auth/logout/`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ export const useCurrentBusiness = () => {
|
||||
return null; // No token, return null instead of making request
|
||||
}
|
||||
|
||||
const { data } = await apiClient.get('/api/business/current/');
|
||||
const { data } = await apiClient.get('/business/current/');
|
||||
|
||||
// Transform backend format to frontend format
|
||||
return {
|
||||
@@ -96,7 +96,7 @@ export const useUpdateBusiness = () => {
|
||||
backendData.customer_dashboard_content = updates.customerDashboardContent;
|
||||
}
|
||||
|
||||
const { data } = await apiClient.patch('/api/business/current/update/', backendData);
|
||||
const { data } = await apiClient.patch('/business/current/update/', backendData);
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
@@ -112,7 +112,7 @@ export const useResources = () => {
|
||||
return useQuery({
|
||||
queryKey: ['resources'],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.get('/api/resources/');
|
||||
const { data } = await apiClient.get('/resources/');
|
||||
return data;
|
||||
},
|
||||
staleTime: 5 * 60 * 1000, // 5 minutes
|
||||
@@ -127,7 +127,7 @@ export const useCreateResource = () => {
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (resourceData: { name: string; type: string; user_id?: string }) => {
|
||||
const { data } = await apiClient.post('/api/resources/', resourceData);
|
||||
const { data } = await apiClient.post('/resources/', resourceData);
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
@@ -143,7 +143,7 @@ export const useBusinessUsers = () => {
|
||||
return useQuery({
|
||||
queryKey: ['businessUsers'],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.get('/api/staff/');
|
||||
const { data } = await apiClient.get('/staff/');
|
||||
return data;
|
||||
},
|
||||
staleTime: 5 * 60 * 1000, // 5 minutes
|
||||
|
||||
@@ -36,7 +36,7 @@ export const useStaff = (filters?: StaffFilters) => {
|
||||
if (filters?.search) params.append('search', filters.search);
|
||||
params.append('show_inactive', 'true'); // Always fetch inactive staff too
|
||||
|
||||
const { data } = await apiClient.get(`/api/staff/?${params}`);
|
||||
const { data } = await apiClient.get(`/staff/?${params}`);
|
||||
|
||||
// Transform backend format to frontend format
|
||||
return data.map((s: any) => ({
|
||||
@@ -68,7 +68,7 @@ export const useUpdateStaff = () => {
|
||||
id: string;
|
||||
updates: { is_active?: boolean; permissions?: StaffPermissions };
|
||||
}) => {
|
||||
const { data } = await apiClient.patch(`/api/staff/${id}/`, updates);
|
||||
const { data } = await apiClient.patch(`/staff/${id}/`, updates);
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
@@ -86,7 +86,7 @@ export const useToggleStaffActive = () => {
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (id: string) => {
|
||||
const { data } = await apiClient.post(`/api/staff/${id}/toggle_active/`);
|
||||
const { data } = await apiClient.post(`/staff/${id}/toggle_active/`);
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
|
||||
@@ -24,7 +24,7 @@ const PlatformLayout: React.FC<PlatformLayoutProps> = ({ user, darkMode, toggleT
|
||||
useScrollToTop();
|
||||
|
||||
// Fetch ticket data when modal is opened from notification
|
||||
const { data: ticketFromNotification } = useTicket(ticketModalId || undefined);
|
||||
const { data: ticketFromNotification } = useTicket(ticketModalId && ticketModalId !== 'undefined' ? ticketModalId : undefined);
|
||||
|
||||
const handleTicketClick = (ticketId: string) => {
|
||||
setTicketModalId(ticketId);
|
||||
@@ -38,7 +38,7 @@ const PlatformLayout: React.FC<PlatformLayoutProps> = ({ user, darkMode, toggleT
|
||||
<div className="flex h-screen bg-gray-100 dark:bg-gray-900">
|
||||
{/* Mobile menu */}
|
||||
<div className={`fixed inset-y-0 left-0 z-40 transform ${isMobileMenuOpen ? 'translate-x-0' : '-translate-x-full'} transition-transform duration-300 ease-in-out md:hidden`}>
|
||||
<PlatformSidebar user={user} isCollapsed={false} toggleCollapse={() => {}} />
|
||||
<PlatformSidebar user={user} isCollapsed={false} toggleCollapse={() => { }} />
|
||||
</div>
|
||||
{isMobileMenuOpen && <div className="fixed inset-0 z-30 bg-black/50 md:hidden" onClick={() => setIsMobileMenuOpen(false)}></div>}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ const EmailTemplates: React.FC = () => {
|
||||
const { data: templates = [], isLoading, error } = useQuery<EmailTemplate[]>({
|
||||
queryKey: ['email-templates'],
|
||||
queryFn: async () => {
|
||||
const { data } = await api.get('/api/email-templates/');
|
||||
const { data } = await api.get('/email-templates/');
|
||||
return data.map((t: any) => ({
|
||||
id: String(t.id),
|
||||
name: t.name,
|
||||
@@ -85,7 +85,7 @@ const EmailTemplates: React.FC = () => {
|
||||
// Delete template mutation
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: async (templateId: string) => {
|
||||
await api.delete(`/api/email-templates/${templateId}/`);
|
||||
await api.delete(`/email-templates/${templateId}/`);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['email-templates'] });
|
||||
@@ -97,7 +97,7 @@ const EmailTemplates: React.FC = () => {
|
||||
// Duplicate template mutation
|
||||
const duplicateMutation = useMutation({
|
||||
mutationFn: async (templateId: string) => {
|
||||
const { data } = await api.post(`/api/email-templates/${templateId}/duplicate/`);
|
||||
const { data } = await api.post(`/email-templates/${templateId}/duplicate/`);
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
|
||||
@@ -41,7 +41,7 @@ const LANGUAGES: Record<CodeLanguage, LanguageConfig> = {
|
||||
// Default test credentials (used when no tokens are available)
|
||||
const DEFAULT_TEST_API_KEY = 'ss_test_<your_test_token_here>';
|
||||
const DEFAULT_TEST_WEBHOOK_SECRET = 'whsec_test_abc123def456ghi789jkl012mno345pqr678';
|
||||
const SANDBOX_URL = 'https://sandbox.smoothschedule.com/api/v1';
|
||||
const SANDBOX_URL = 'https://sandbox.smoothschedule.com/v1';
|
||||
|
||||
// Multi-language code interface
|
||||
interface MultiLangCode {
|
||||
@@ -1111,7 +1111,7 @@ my $response = $ua->get('${SANDBOX_URL}/services/',
|
||||
)}
|
||||
|
||||
<a
|
||||
href="/api/v1/docs/"
|
||||
href="/v1/docs/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center gap-2 px-4 py-2 text-sm font-medium text-purple-600 dark:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20 rounded-lg transition-colors"
|
||||
|
||||
@@ -64,7 +64,7 @@ const MyPlugins: React.FC = () => {
|
||||
const { data: plugins = [], isLoading, error } = useQuery<PluginInstallation[]>({
|
||||
queryKey: ['plugin-installations'],
|
||||
queryFn: async () => {
|
||||
const { data } = await api.get('/api/plugin-installations/');
|
||||
const { data } = await api.get('/plugin-installations/');
|
||||
return data.map((p: any) => ({
|
||||
id: String(p.id),
|
||||
template: String(p.template),
|
||||
@@ -88,7 +88,7 @@ const MyPlugins: React.FC = () => {
|
||||
// Uninstall plugin mutation
|
||||
const uninstallMutation = useMutation({
|
||||
mutationFn: async (pluginId: string) => {
|
||||
await api.delete(`/api/plugin-installations/${pluginId}/`);
|
||||
await api.delete(`/plugin-installations/${pluginId}/`);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['plugin-installations'] });
|
||||
@@ -100,7 +100,7 @@ const MyPlugins: React.FC = () => {
|
||||
// Rate plugin mutation
|
||||
const rateMutation = useMutation({
|
||||
mutationFn: async ({ pluginId, rating, review }: { pluginId: string; rating: number; review: string }) => {
|
||||
const { data } = await api.post(`/api/plugin-installations/${pluginId}/rate/`, {
|
||||
const { data } = await api.post(`/plugin-installations/${pluginId}/rate/`, {
|
||||
rating,
|
||||
review,
|
||||
});
|
||||
@@ -118,7 +118,7 @@ const MyPlugins: React.FC = () => {
|
||||
// Update plugin mutation
|
||||
const updateMutation = useMutation({
|
||||
mutationFn: async (pluginId: string) => {
|
||||
const { data } = await api.post(`/api/plugin-installations/${pluginId}/update/`);
|
||||
const { data } = await api.post(`/plugin-installations/${pluginId}/update/`);
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
@@ -129,7 +129,7 @@ const MyPlugins: React.FC = () => {
|
||||
// Edit config mutation
|
||||
const editConfigMutation = useMutation({
|
||||
mutationFn: async ({ pluginId, configValues }: { pluginId: string; configValues: Record<string, any> }) => {
|
||||
const { data } = await api.patch(`/api/plugin-installations/${pluginId}/`, {
|
||||
const { data } = await api.patch(`/plugin-installations/${pluginId}/`, {
|
||||
config_values: configValues,
|
||||
});
|
||||
return data;
|
||||
|
||||
@@ -95,7 +95,7 @@ const PluginMarketplace: React.FC = () => {
|
||||
const { data: plugins = [], isLoading, error } = useQuery<PluginTemplate[]>({
|
||||
queryKey: ['plugin-templates', 'marketplace'],
|
||||
queryFn: async () => {
|
||||
const { data } = await api.get('/api/plugin-templates/?view=marketplace');
|
||||
const { data } = await api.get('/plugin-templates/?view=marketplace');
|
||||
return data.map((p: any) => ({
|
||||
id: String(p.id),
|
||||
name: p.name,
|
||||
@@ -120,7 +120,7 @@ const PluginMarketplace: React.FC = () => {
|
||||
const { data: installedPlugins = [] } = useQuery<{ template: number }[]>({
|
||||
queryKey: ['plugin-installations'],
|
||||
queryFn: async () => {
|
||||
const { data } = await api.get('/api/plugin-installations/');
|
||||
const { data } = await api.get('/plugin-installations/');
|
||||
return data;
|
||||
},
|
||||
});
|
||||
@@ -133,7 +133,7 @@ const PluginMarketplace: React.FC = () => {
|
||||
// Install plugin mutation
|
||||
const installMutation = useMutation({
|
||||
mutationFn: async (templateId: string) => {
|
||||
const { data } = await api.post('/api/plugin-installations/', {
|
||||
const { data } = await api.post('/plugin-installations/', {
|
||||
template: templateId,
|
||||
});
|
||||
return data;
|
||||
@@ -187,7 +187,7 @@ const PluginMarketplace: React.FC = () => {
|
||||
// Fetch full plugin details including plugin_code
|
||||
setIsLoadingDetails(true);
|
||||
try {
|
||||
const { data } = await api.get(`/api/plugin-templates/${plugin.id}/`);
|
||||
const { data } = await api.get(`/plugin-templates/${plugin.id}/`);
|
||||
setSelectedPlugin({
|
||||
...plugin,
|
||||
pluginCode: data.plugin_code,
|
||||
|
||||
@@ -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'] });
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useSearchParams, useNavigate } from 'react-router-dom';
|
||||
import { CheckCircle, XCircle, Loader2, Mail, ShieldCheck } from 'lucide-react';
|
||||
import apiClient from '../api/client';
|
||||
import { deleteCookie } from '../utils/cookies';
|
||||
import { getBaseDomain } from '../utils/domain';
|
||||
|
||||
type VerificationStatus = 'pending' | 'loading' | 'success' | 'error' | 'already_verified';
|
||||
|
||||
@@ -115,7 +116,12 @@ const VerifyEmail: React.FC = () => {
|
||||
Your email address has been successfully verified. You can now sign in to your account.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => window.location.href = '/login'}
|
||||
onClick={() => {
|
||||
const protocol = window.location.protocol;
|
||||
const baseDomain = getBaseDomain();
|
||||
const port = window.location.port ? `:${window.location.port}` : '';
|
||||
window.location.href = `${protocol}//${baseDomain}${port}/login`;
|
||||
}}
|
||||
className="w-full px-4 py-3 bg-brand-500 text-white rounded-lg hover:bg-brand-600 transition-colors font-medium"
|
||||
>
|
||||
Go to Login
|
||||
|
||||
@@ -91,7 +91,7 @@ const EditPlatformUserModal: React.FC<EditPlatformUserModalProps> = ({
|
||||
// Update mutation
|
||||
const updateMutation = useMutation({
|
||||
mutationFn: async (data: any) => {
|
||||
const response = await apiClient.patch(`/api/platform/users/${user.id}/`, data);
|
||||
const response = await apiClient.patch(`/platform/users/${user.id}/`, data);
|
||||
return response.data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
|
||||
Reference in New Issue
Block a user