Skip to content

Commit

Permalink
fix: update api url
Browse files Browse the repository at this point in the history
  • Loading branch information
suyuan32 committed Dec 2, 2022
1 parent 1d416bf commit bf119f7
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 66 deletions.
9 changes: 5 additions & 4 deletions src/api/sys/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { ApiInfo, ApiListResp } from './model/apiModel';

enum Api {
GetApiList = '/sys-api/api/list',
CreateOrUpdateOrDeleteApi = '/sys-api/api',
CreateOrUpdateApi = '/sys-api/api/create_or_update',
DeleteApi = '/sys-api/api/delete',
}

/**
Expand All @@ -22,7 +23,7 @@ export const getApiList = (params: BasePageReq) => {
*/
export const createOrUpdateApi = (params: ApiInfo, mode: ErrorMessageMode = 'modal') => {
return defHttp.post<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteApi, params: params },
{ url: Api.CreateOrUpdateApi, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -34,8 +35,8 @@ export const createOrUpdateApi = (params: ApiInfo, mode: ErrorMessageMode = 'mod
* @description: delete api
*/
export const deleteApi = (params: BaseIdReq, mode: ErrorMessageMode = 'modal') => {
return defHttp.delete<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteApi, params: params },
return defHttp.post<BaseResp>(
{ url: Api.DeleteApi, params: params },
{
errorMessageMode: mode,
},
Expand Down
25 changes: 6 additions & 19 deletions src/api/sys/authority.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
} from './model/authorityModel';

enum Api {
CreateOrUpdateOrDeleteApiAuthority = '/sys-api/authority/api',
CreateOrUpdateOrDeleteMenuAuthority = '/sys-api/authority/menu',
CreateOrUpdateApiAuthority = '/sys-api/authority/api/create_or_update',
CreateOrUpdateMenuAuthority = '/sys-api/authority/menu/create_or_update',
GetRoleMenuList = '/sys-api/authority/menu/role',
GetRoleApiList = '/sys-api/authority/api/role',
GetApiList = '/sys-api/api/list',
Expand All @@ -27,7 +27,7 @@ export const getApiList = (params: ApiListReq) => {
};

/**
* @description: Get user menu based on api id
* @description: Get api authorization list
*/

export const getApiAuthority = (params: BaseIdReq) => {
Expand All @@ -36,27 +36,14 @@ export const getApiAuthority = (params: BaseIdReq) => {

/**
* author: ryan
* @description: create a new menu
* @description: create or update api authorization
*/
export const createOrUpdateApiAuthority = (
params: ApiAuthorityReq,
mode: ErrorMessageMode = 'message',
) => {
return defHttp.post<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteApiAuthority, params: params },
{
errorMessageMode: mode,
},
);
};

/**
* author: Ryan Su
* @description: delete menu
*/
export const deleteApiAuthority = (params: BaseIdReq, mode: ErrorMessageMode = 'message') => {
return defHttp.delete<BaseResp>(
{ url: Api.GetRoleMenuList, params: params },
{ url: Api.CreateOrUpdateApiAuthority, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -73,7 +60,7 @@ export const createOrUpdateMenuAuthority = (
mode: ErrorMessageMode = 'message',
) => {
return defHttp.post<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteMenuAuthority, params: params },
{ url: Api.CreateOrUpdateMenuAuthority, params: params },
{
errorMessageMode: mode,
},
Expand Down
24 changes: 13 additions & 11 deletions src/api/sys/dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import {

enum Api {
GetDictionaryList = '/sys-api/dict/list',
CreateOrUpdateOrDeleteDictionary = '/sys-api/dict',
CreateOrUpdateDictionary = '/sys-api/dict/create_or_update',
DeleteDictionary = '/sys-api/dict/delete',
GetDictionaryDetailList = '/sys-api/dict/detail/list',
CreateOrUpdateOrDeleteDictionaryDetail = '/sys-api/dict/detail',
CreateOrUpdateDictionaryDetail = '/sys-api/dict/detail/create_or_update',
DeleteDictionaryDetail = '/sys-api/dict/detail/delete',
}

/**
Expand All @@ -25,14 +27,14 @@ export const getDictionaryList = (params: BasePageReq) => {

/**
* author: ryan
* @description: create a new dictionary
* @description: create or update a new dictionary
*/
export const createOrUpdateDictionary = (
params: DictionaryInfo,
mode: ErrorMessageMode = 'modal',
) => {
return defHttp.post<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteDictionary, params: params },
{ url: Api.CreateOrUpdateDictionary, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -41,11 +43,11 @@ export const createOrUpdateDictionary = (

/**
* author: Ryan Su
* @description: delete dictionary
* @description: delete a dictionary
*/
export const deleteDictionary = (params: BaseIdReq, mode: ErrorMessageMode = 'modal') => {
return defHttp.delete<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteDictionary, params: params },
return defHttp.post<BaseResp>(
{ url: Api.DeleteDictionary, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -72,7 +74,7 @@ export const createOrUpdateDictionaryDetail = (
mode: ErrorMessageMode = 'modal',
) => {
return defHttp.post<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteDictionaryDetail, params: params },
{ url: Api.CreateOrUpdateDictionaryDetail, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -81,11 +83,11 @@ export const createOrUpdateDictionaryDetail = (

/**
* author: Ryan Su
* @description: delete dictionary detail
* @description: delete a dictionary detail
*/
export const deleteDictionaryDetail = (params: BaseIdReq, mode: ErrorMessageMode = 'modal') => {
return defHttp.delete<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteDictionaryDetail, params: params },
return defHttp.post<BaseResp>(
{ url: Api.DeleteDictionaryDetail, params: params },
{
errorMessageMode: mode,
},
Expand Down
26 changes: 14 additions & 12 deletions src/api/sys/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import { BaseDataResp, BaseIdReq, BaseResp } from '/@/api/model/baseModel';
enum Api {
GetMenuListByRole = '/sys-api/menu/role',
GetAllMenu = '/sys-api/menu/list',
CreateOrUpdateOrDeleteMenu = '/sys-api/menu',
CreateOrUpdateOrDeleteMenuParam = '/sys-api/menu/param',
CreateOrUpdateMenu = '/sys-api/menu/create_or_update',
DeleteMenu = '/sys-api/menu/delete',
CreateOrUpdateMenuParam = '/sys-api/menu/param/create_or_update',
DeleteMenuParam = '/sys-api/menu/param/delete',
GetMenuParamsByMenuId = '/sys-api/menu/param/list',
}

/**
* @description: Get user menu based on role id
* @description: Get user menu list by role id
*/

export const getMenuList = () => {
Expand All @@ -28,7 +30,7 @@ export const getMenuList = () => {

/**
* author: ryan
* @description: Get all the menu list
* @description: Get all the menus
*/

export const getAllMenu = (params?: MenuParams) => {
Expand All @@ -44,7 +46,7 @@ export const createOrUpdateMenu = (
mode: ErrorMessageMode = 'message',
) => {
return defHttp.post<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteMenu, params: params },
{ url: Api.CreateOrUpdateMenu, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -53,11 +55,11 @@ export const createOrUpdateMenu = (

/**
* author: Ryan Su
* @description: Delete menu
* @description: Delete a menu
*/
export const deleteMenu = (params: BaseIdReq, mode: ErrorMessageMode = 'message') => {
return defHttp.delete<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteMenu, params: params },
return defHttp.post<BaseResp>(
{ url: Api.DeleteMenu, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -73,7 +75,7 @@ export const createOrUpdateMenuParam = (
mode: ErrorMessageMode = 'message',
) => {
return defHttp.post<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteMenuParam, params: params },
{ url: Api.CreateOrUpdateMenuParam, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -82,11 +84,11 @@ export const createOrUpdateMenuParam = (

/**
* author: Ryan Su
* @description: Delete menu parameter
* @description: Delete a menu parameter
*/
export const deleteMenuParam = (params: BaseIdReq, mode: ErrorMessageMode = 'message') => {
return defHttp.delete<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteMenuParam, params: params },
return defHttp.post<BaseResp>(
{ url: Api.DeleteMenuParam, params: params },
{
errorMessageMode: mode,
},
Expand Down
11 changes: 6 additions & 5 deletions src/api/sys/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ enum Api {
OauthLogin = '/sys-api/oauth/login',
OauthLoginCallback = '/sys-api/oauth/login/callback',
GetProviderList = '/sys-api/oauth/provider/list',
CreateOrUpdateOrDeleteProvider = '/sys-api/oauth/provider',
CreateOrUpdateProvider = '/sys-api/oauth/provider/create_or_update',
DeleteProvider = '/sys-api/oauth/provider/delete',
}

/**
Expand All @@ -25,7 +26,7 @@ export const getProviderList = (params: BasePageReq) => {
*/
export const createOrUpdateProvider = (params: ProviderInfo, mode: ErrorMessageMode = 'modal') => {
return defHttp.post<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteProvider, params: params },
{ url: Api.CreateOrUpdateProvider, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -34,11 +35,11 @@ export const createOrUpdateProvider = (params: ProviderInfo, mode: ErrorMessageM

/**
* author: Ryan Su
* @description: delete provider
* @description: delete a provider
*/
export const deleteProvider = (params: BaseIdReq, mode: ErrorMessageMode = 'modal') => {
return defHttp.delete<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteProvider, params: params },
return defHttp.post<BaseResp>(
{ url: Api.DeleteProvider, params: params },
{
errorMessageMode: mode,
},
Expand Down
13 changes: 7 additions & 6 deletions src/api/sys/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { RoleInfo, RoleListResp } from './model/roleModel';

enum Api {
GetRoleList = '/sys-api/role/list',
CreateOrUpdateOrDeleteRole = '/sys-api/role',
CreateOrUpdateRole = '/sys-api/role/create_or_update',
DeleteRole = '/sys-api/role/delete',
SetRoleStatus = '/sys-api/role/status',
}

Expand All @@ -19,11 +20,11 @@ export const getRoleList = (params: BasePageReq) => {

/**
* author: ryan
* @description: create a new menu
* @description: create a new role
*/
export const createOrUpdateRole = (params: RoleInfo, mode: ErrorMessageMode = 'message') => {
return defHttp.post<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteRole, params: params },
{ url: Api.CreateOrUpdateRole, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -32,11 +33,11 @@ export const createOrUpdateRole = (params: RoleInfo, mode: ErrorMessageMode = 'm

/**
* author: Ryan Su
* @description: delete menu
* @description: delete a role
*/
export const deleteRole = (params: BaseIdReq, mode: ErrorMessageMode = 'message') => {
return defHttp.delete<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteRole, params: params },
return defHttp.post<BaseResp>(
{ url: Api.DeleteRole, params: params },
{
errorMessageMode: mode,
},
Expand Down
13 changes: 7 additions & 6 deletions src/api/sys/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { TokenInfo, TokenListResp } from './model/tokenModel ';

enum Api {
GetTokenList = '/sys-api/token/list',
CreateOrUpdateOrDeleteToken = '/sys-api/token',
CreateOrUpdateToken = '/sys-api/token/create_or_update',
DeleteToken = '/sys-api/token/delete',
SetTokenStatus = '/sys-api/token/status',
Logout = '/sys-api/token/logout',
}
Expand All @@ -24,7 +25,7 @@ export const getTokenList = (params: BasePageReq) => {
*/
export const createOrUpdateApi = (params: TokenInfo, mode: ErrorMessageMode = 'modal') => {
return defHttp.post<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteToken, params: params },
{ url: Api.CreateOrUpdateToken, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -33,11 +34,11 @@ export const createOrUpdateApi = (params: TokenInfo, mode: ErrorMessageMode = 'm

/**
* author: Ryan Su
* @description: delete token
* @description: delete a token
*/
export const deleteToken = (params: BaseIdReq, mode: ErrorMessageMode = 'modal') => {
return defHttp.delete<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteToken, params: params },
return defHttp.post<BaseResp>(
{ url: Api.DeleteToken, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -46,7 +47,7 @@ export const deleteToken = (params: BaseIdReq, mode: ErrorMessageMode = 'modal')

/**
* author: Ryan Su
* @description: set token status
* @description: set the token status
*/
export const setTokenStatus = (id: number, status: number) =>
defHttp.post({ url: Api.SetTokenStatus, params: { id, status } });
Expand Down
7 changes: 4 additions & 3 deletions src/api/sys/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ enum Api {
GetPermCode = '/sys-api/user/perm',
GetCaptcha = '/sys-api/captcha',
GetUserList = '/sys-api/user/list',
CreateOrUpdateOrDeleteUser = '/sys-api/user',
CreateOrUpdateUser = '/sys-api/user/create_or_update',
DeleteUser = '/sys-api/user/delete',
SetUserStatus = '/sys-api/user/status',
GetProfile = '/sys-api/user/profile',
ChangePassword = '/sys-api/user/change-password',
Expand Down Expand Up @@ -107,7 +108,7 @@ export const getUserList = (params: UserListReq) => {
*/
export const createOrUpdateUser = (params: UserInfo, mode: ErrorMessageMode = 'message') => {
return defHttp.post<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteUser, params: params },
{ url: Api.CreateOrUpdateUser, params: params },
{
errorMessageMode: mode,
},
Expand All @@ -120,7 +121,7 @@ export const createOrUpdateUser = (params: UserInfo, mode: ErrorMessageMode = 'm
*/
export const deleteUser = (params: BaseIdReq, mode: ErrorMessageMode = 'message') => {
return defHttp.delete<BaseResp>(
{ url: Api.CreateOrUpdateOrDeleteUser, params: params },
{ url: Api.DeleteUser, params: params },
{
errorMessageMode: mode,
},
Expand Down

0 comments on commit bf119f7

Please sign in to comment.