refactor(api): Remove '/api' prefix from frontend API calls and config
- Removed '/api/' prefix from endpoint paths in auth.ts, notifications.ts, oauth.ts, and platform.ts to align with the backend URL reconfiguration. - Updated 'API_BASE_URL' in config.ts to remove the '/api' suffix, ensuring that API requests are correctly routed to the root of the 'api' subdomain (e.g., http://api.lvh.me:8000/). - Included improvements to login redirect logic in client.ts.
This commit is contained in:
@@ -85,7 +85,7 @@ export interface PlatformUser {
|
||||
* Get all businesses (platform admin only)
|
||||
*/
|
||||
export const getBusinesses = async (): Promise<PlatformBusiness[]> => {
|
||||
const response = await apiClient.get<PlatformBusiness[]>('/api/platform/businesses/');
|
||||
const response = await apiClient.get<PlatformBusiness[]>('/platform/businesses/');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -97,7 +97,7 @@ export const updateBusiness = async (
|
||||
data: PlatformBusinessUpdate
|
||||
): Promise<PlatformBusiness> => {
|
||||
const response = await apiClient.patch<PlatformBusiness>(
|
||||
`/api/platform/businesses/${businessId}/`,
|
||||
`/platform/businesses/${businessId}/`,
|
||||
data
|
||||
);
|
||||
return response.data;
|
||||
@@ -110,7 +110,7 @@ export const createBusiness = async (
|
||||
data: PlatformBusinessCreate
|
||||
): Promise<PlatformBusiness> => {
|
||||
const response = await apiClient.post<PlatformBusiness>(
|
||||
'/api/platform/businesses/',
|
||||
'/platform/businesses/',
|
||||
data
|
||||
);
|
||||
return response.data;
|
||||
@@ -120,7 +120,7 @@ export const createBusiness = async (
|
||||
* Get all users (platform admin only)
|
||||
*/
|
||||
export const getUsers = async (): Promise<PlatformUser[]> => {
|
||||
const response = await apiClient.get<PlatformUser[]>('/api/platform/users/');
|
||||
const response = await apiClient.get<PlatformUser[]>('/platform/users/');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -128,7 +128,7 @@ export const getUsers = async (): Promise<PlatformUser[]> => {
|
||||
* Get users for a specific business
|
||||
*/
|
||||
export const getBusinessUsers = async (businessId: number): Promise<PlatformUser[]> => {
|
||||
const response = await apiClient.get<PlatformUser[]>(`/api/platform/users/?business=${businessId}`);
|
||||
const response = await apiClient.get<PlatformUser[]>(`/platform/users/?business=${businessId}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -136,7 +136,7 @@ export const getBusinessUsers = async (businessId: number): Promise<PlatformUser
|
||||
* Verify a user's email (platform admin only)
|
||||
*/
|
||||
export const verifyUserEmail = async (userId: number): Promise<void> => {
|
||||
await apiClient.post(`/api/platform/users/${userId}/verify_email/`);
|
||||
await apiClient.post(`/platform/users/${userId}/verify_email/`);
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
@@ -218,7 +218,7 @@ export interface TenantInvitationAccept {
|
||||
* Get all tenant invitations (platform admin only)
|
||||
*/
|
||||
export const getTenantInvitations = async (): Promise<TenantInvitation[]> => {
|
||||
const response = await apiClient.get<TenantInvitation[]>('/api/platform/tenant-invitations/');
|
||||
const response = await apiClient.get<TenantInvitation[]>('/platform/tenant-invitations/');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -229,7 +229,7 @@ export const createTenantInvitation = async (
|
||||
data: TenantInvitationCreate
|
||||
): Promise<TenantInvitation> => {
|
||||
const response = await apiClient.post<TenantInvitation>(
|
||||
'/api/platform/tenant-invitations/',
|
||||
'/platform/tenant-invitations/',
|
||||
data
|
||||
);
|
||||
return response.data;
|
||||
@@ -239,14 +239,14 @@ export const createTenantInvitation = async (
|
||||
* Resend a tenant invitation (platform admin only)
|
||||
*/
|
||||
export const resendTenantInvitation = async (invitationId: number): Promise<void> => {
|
||||
await apiClient.post(`/api/platform/tenant-invitations/${invitationId}/resend/`);
|
||||
await apiClient.post(`/platform/tenant-invitations/${invitationId}/resend/`);
|
||||
};
|
||||
|
||||
/**
|
||||
* Cancel a tenant invitation (platform admin only)
|
||||
*/
|
||||
export const cancelTenantInvitation = async (invitationId: number): Promise<void> => {
|
||||
await apiClient.post(`/api/platform/tenant-invitations/${invitationId}/cancel/`);
|
||||
await apiClient.post(`/platform/tenant-invitations/${invitationId}/cancel/`);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -254,7 +254,7 @@ export const cancelTenantInvitation = async (invitationId: number): Promise<void
|
||||
*/
|
||||
export const getInvitationByToken = async (token: string): Promise<TenantInvitationDetail> => {
|
||||
const response = await apiClient.get<TenantInvitationDetail>(
|
||||
`/api/platform/tenant-invitations/token/${token}/`
|
||||
`/platform/tenant-invitations/token/${token}/`
|
||||
);
|
||||
return response.data;
|
||||
};
|
||||
@@ -267,7 +267,7 @@ export const acceptInvitation = async (
|
||||
data: TenantInvitationAccept
|
||||
): Promise<{ detail: string }> => {
|
||||
const response = await apiClient.post<{ detail: string }>(
|
||||
`/api/platform/tenant-invitations/token/${token}/accept/`,
|
||||
`/platform/tenant-invitations/token/${token}/accept/`,
|
||||
data
|
||||
);
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user