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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user