Skip to content

Commit

Permalink
[*] 适配后端标准化返回
Browse files Browse the repository at this point in the history
  • Loading branch information
Muska-Ami committed Sep 20, 2024
1 parent 7545ede commit 4913015
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion _deprecated/LanLobby.vue
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ function getPrivateLobby() {
function getProxyList() {
const rs = get(
'https://api-v2.locyanfrp.cn/api/v2/proxies/getlist?username=' +
'https://api-v2.locyanfrp.cn/api/v2/proxies/list?username=' +
localStorage.getItem('username')
)
rs.then((res) => {
Expand Down
4 changes: 2 additions & 2 deletions src/api/v2/oauth/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import loginByToken from './loginByToken'
import login from './login'
import qq from './qq'

export default {
qq: qq,
loginByToken: loginByToken
login: login
}
5 changes: 5 additions & 0 deletions src/api/v2/oauth/login/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import token from './token'

export default {
token: token
}
12 changes: 12 additions & 0 deletions src/api/v2/oauth/login/token.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import base from '@/api/base'
//@ts-ignore
import { get } from '@/utils/request'

const token = async (token: string) => {
const rs = await get(`${base.api_v2_url}/oauth/login/token`, {
token: token
})
return base.buildResponse(rs)
}

export default token
12 changes: 0 additions & 12 deletions src/api/v2/oauth/loginByToken.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/api/v2/proxies/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import add from './add'
import deleteX from './delete'
import down from './down'
import getlist from './getlist'
import list from './list'
import update from './update'

export default {
add: add,
update: update,
getlist: getlist,
list: list,
delete: deleteX,
down: down
}
6 changes: 3 additions & 3 deletions src/api/v2/proxies/getlist.ts → src/api/v2/proxies/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import base from '@/api/base'
//@ts-ignore
import { get } from '@/utils/request'

const getlist = async (username: string) => {
const rs = get(`${base.api_v2_url}/proxies/getlist`, {
const list = async (username: string) => {
const rs = get(`${base.api_v2_url}/proxies/list`, {
username: username
})
return base.buildResponse(await rs)
}

export default getlist
export default list
2 changes: 1 addition & 1 deletion src/views/auth/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ if (token !== null) {
other_login.value = true
let rs
try {
rs = await api.v2.oauth.loginByToken(token)
rs = await api.v2.oauth.login.token(token)
} catch (e) {
sendErrorMessage('登录失败: ' + e)
router.push('/auth/login')
Expand Down
2 changes: 1 addition & 1 deletion src/views/proxies/ProxiesView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ async function initList() {
let rs2
try {
rs2 = await api.v2.proxies.getlist(userData.getters.get_username)
rs2 = await api.v2.proxies.list(userData.getters.get_username)
} catch (e) {
sendErrorMessage('请求节点列表失败: ' + e)
}
Expand Down

0 comments on commit 4913015

Please sign in to comment.