updates
This commit is contained in:
88
Frontend/src/services/api/systemSettingsService.ts
Normal file
88
Frontend/src/services/api/systemSettingsService.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
import apiClient from './apiClient';
|
||||
|
||||
export interface PlatformCurrencyResponse {
|
||||
status: string;
|
||||
data: {
|
||||
currency: string;
|
||||
updated_at: string | null;
|
||||
updated_by: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
export interface UpdateCurrencyRequest {
|
||||
currency: string;
|
||||
}
|
||||
|
||||
export interface StripeSettingsResponse {
|
||||
status: string;
|
||||
data: {
|
||||
stripe_secret_key: string;
|
||||
stripe_publishable_key: string;
|
||||
stripe_webhook_secret: string;
|
||||
stripe_secret_key_masked: string;
|
||||
stripe_webhook_secret_masked: string;
|
||||
has_secret_key: boolean;
|
||||
has_publishable_key: boolean;
|
||||
has_webhook_secret: boolean;
|
||||
updated_at?: string | null;
|
||||
updated_by?: string | null;
|
||||
};
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface UpdateStripeSettingsRequest {
|
||||
stripe_secret_key?: string;
|
||||
stripe_publishable_key?: string;
|
||||
stripe_webhook_secret?: string;
|
||||
}
|
||||
|
||||
const systemSettingsService = {
|
||||
/**
|
||||
* Get platform currency (public endpoint)
|
||||
*/
|
||||
getPlatformCurrency: async (): Promise<PlatformCurrencyResponse> => {
|
||||
const response = await apiClient.get<PlatformCurrencyResponse>(
|
||||
'/api/admin/system-settings/currency'
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Update platform currency (Admin only)
|
||||
*/
|
||||
updatePlatformCurrency: async (
|
||||
currency: string
|
||||
): Promise<PlatformCurrencyResponse> => {
|
||||
const response = await apiClient.put<PlatformCurrencyResponse>(
|
||||
'/api/admin/system-settings/currency',
|
||||
{ currency }
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get Stripe settings (Admin only)
|
||||
*/
|
||||
getStripeSettings: async (): Promise<StripeSettingsResponse> => {
|
||||
const response = await apiClient.get<StripeSettingsResponse>(
|
||||
'/api/admin/system-settings/stripe'
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Update Stripe settings (Admin only)
|
||||
*/
|
||||
updateStripeSettings: async (
|
||||
settings: UpdateStripeSettingsRequest
|
||||
): Promise<StripeSettingsResponse> => {
|
||||
const response = await apiClient.put<StripeSettingsResponse>(
|
||||
'/api/admin/system-settings/stripe',
|
||||
settings
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
||||
export default systemSettingsService;
|
||||
|
||||
Reference in New Issue
Block a user