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:
@@ -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