♻️ refactor: Refactor API endpoints to use dynamic API prefix from environment variables
- Updated all service files to replace hardcoded API paths with `${import.meta.env.VITE_API_PREFIX}` for better configurability.
- Ensured consistency across user, common, and gateway services by applying the new API prefix format.
- Removed unnecessary comments and maintained ESLint disable directives where applicable.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
//
|
||||
/* eslint-disable */
|
||||
import request from "@workspace/ui/lib/request";
|
||||
|
||||
/** Get Currency Config GET /v1/admin/system/currency_config */
|
||||
export async function getCurrencyConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.CurrencyConfig }>(
|
||||
"/api/v1/admin/system/currency_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/currency_config`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -19,7 +18,7 @@ export async function updateCurrencyConfig(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/currency_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/currency_config`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -34,7 +33,7 @@ export async function updateCurrencyConfig(
|
||||
/** Get Node Multiplier GET /v1/admin/system/get_node_multiplier */
|
||||
export async function getNodeMultiplier(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.GetNodeMultiplierResponse }>(
|
||||
"/api/v1/admin/system/get_node_multiplier",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/get_node_multiplier`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -45,7 +44,7 @@ export async function getNodeMultiplier(options?: { [key: string]: any }) {
|
||||
/** Get invite config GET /v1/admin/system/invite_config */
|
||||
export async function getInviteConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.InviteConfig }>(
|
||||
"/api/v1/admin/system/invite_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/invite_config`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -59,7 +58,7 @@ export async function updateInviteConfig(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/invite_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/invite_config`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -74,7 +73,7 @@ export async function updateInviteConfig(
|
||||
/** Get Module Config GET /v1/admin/system/module */
|
||||
export async function getModuleConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.ModuleConfig }>(
|
||||
"/api/v1/admin/system/module",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/module`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -85,7 +84,7 @@ export async function getModuleConfig(options?: { [key: string]: any }) {
|
||||
/** Get node config GET /v1/admin/system/node_config */
|
||||
export async function getNodeConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.NodeConfig }>(
|
||||
"/api/v1/admin/system/node_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/node_config`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -99,7 +98,7 @@ export async function updateNodeConfig(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/node_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/node_config`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -114,7 +113,9 @@ export async function updateNodeConfig(
|
||||
/** PreView Node Multiplier GET /v1/admin/system/node_multiplier/preview */
|
||||
export async function preViewNodeMultiplier(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.PreViewNodeMultiplierResponse }>(
|
||||
"/api/v1/admin/system/node_multiplier/preview",
|
||||
`${
|
||||
import.meta.env.VITE_API_PREFIX
|
||||
}/v1/admin/system/node_multiplier/preview`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -125,7 +126,7 @@ export async function preViewNodeMultiplier(options?: { [key: string]: any }) {
|
||||
/** get Privacy Policy Config GET /v1/admin/system/privacy */
|
||||
export async function getPrivacyPolicyConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.PrivacyPolicyConfig }>(
|
||||
"/api/v1/admin/system/privacy",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/privacy`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -139,7 +140,7 @@ export async function updatePrivacyPolicyConfig(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/privacy",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/privacy`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -154,7 +155,7 @@ export async function updatePrivacyPolicyConfig(
|
||||
/** Get register config GET /v1/admin/system/register_config */
|
||||
export async function getRegisterConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.RegisterConfig }>(
|
||||
"/api/v1/admin/system/register_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/register_config`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -168,7 +169,7 @@ export async function updateRegisterConfig(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/register_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/register_config`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -186,7 +187,7 @@ export async function setNodeMultiplier(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/set_node_multiplier",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/set_node_multiplier`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -201,7 +202,7 @@ export async function setNodeMultiplier(
|
||||
/** setting telegram bot POST /v1/admin/system/setting_telegram_bot */
|
||||
export async function settingTelegramBot(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/setting_telegram_bot",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/setting_telegram_bot`,
|
||||
{
|
||||
method: "POST",
|
||||
...(options || {}),
|
||||
@@ -212,7 +213,7 @@ export async function settingTelegramBot(options?: { [key: string]: any }) {
|
||||
/** Get site config GET /v1/admin/system/site_config */
|
||||
export async function getSiteConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.SiteConfig }>(
|
||||
"/api/v1/admin/system/site_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/site_config`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -226,7 +227,7 @@ export async function updateSiteConfig(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/site_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/site_config`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -241,7 +242,7 @@ export async function updateSiteConfig(
|
||||
/** Get subscribe config GET /v1/admin/system/subscribe_config */
|
||||
export async function getSubscribeConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.SubscribeConfig }>(
|
||||
"/api/v1/admin/system/subscribe_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/subscribe_config`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -255,7 +256,7 @@ export async function updateSubscribeConfig(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/subscribe_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/subscribe_config`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -270,7 +271,7 @@ export async function updateSubscribeConfig(
|
||||
/** Get Team of Service Config GET /v1/admin/system/tos_config */
|
||||
export async function getTosConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.TosConfig }>(
|
||||
"/api/v1/admin/system/tos_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/tos_config`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -284,7 +285,7 @@ export async function updateTosConfig(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/tos_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/tos_config`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -299,7 +300,7 @@ export async function updateTosConfig(
|
||||
/** Get Verify Code Config GET /v1/admin/system/verify_code_config */
|
||||
export async function getVerifyCodeConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.VerifyCodeConfig }>(
|
||||
"/api/v1/admin/system/verify_code_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/verify_code_config`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -313,7 +314,7 @@ export async function updateVerifyCodeConfig(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/verify_code_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/verify_code_config`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -328,7 +329,7 @@ export async function updateVerifyCodeConfig(
|
||||
/** Get verify config GET /v1/admin/system/verify_config */
|
||||
export async function getVerifyConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.VerifyConfig }>(
|
||||
"/api/v1/admin/system/verify_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/verify_config`,
|
||||
{
|
||||
method: "GET",
|
||||
...(options || {}),
|
||||
@@ -342,7 +343,7 @@ export async function updateVerifyConfig(
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
"/api/v1/admin/system/verify_config",
|
||||
`${import.meta.env.VITE_API_PREFIX}/v1/admin/system/verify_config`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user