|
|
@ -77,6 +77,10 @@ const loadTokens = async (page = currentPage.value, limit = currentLimit.value) |
|
|
|
pagination.pageSize = 10 |
|
|
|
pagination.pageSize = 10 |
|
|
|
|
|
|
|
|
|
|
|
tokens.value = response.list as IApiTokenInfo[] |
|
|
|
tokens.value = response.list as IApiTokenInfo[] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!allTokens.value.length) { |
|
|
|
|
|
|
|
await loadAllTokens(pagination.total) |
|
|
|
|
|
|
|
} |
|
|
|
} catch (e: any) { |
|
|
|
} catch (e: any) { |
|
|
|
message.error(await extractSdkResponseErrorMsg(e)) |
|
|
|
message.error(await extractSdkResponseErrorMsg(e)) |
|
|
|
} |
|
|
|
} |
|
|
@ -85,11 +89,11 @@ const loadTokens = async (page = currentPage.value, limit = currentLimit.value) |
|
|
|
loadTokens() |
|
|
|
loadTokens() |
|
|
|
|
|
|
|
|
|
|
|
// To set default next token name we should need to fetch all token first |
|
|
|
// To set default next token name we should need to fetch all token first |
|
|
|
const loadAllTokens = async () => { |
|
|
|
const loadAllTokens = async (limit = pagination.total) => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const response: any = await api.orgTokens.list({ |
|
|
|
const response: any = await api.orgTokens.list({ |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
limit: -1, |
|
|
|
limit: limit, |
|
|
|
}, |
|
|
|
}, |
|
|
|
} as RequestParams) |
|
|
|
} as RequestParams) |
|
|
|
if (!response) return |
|
|
|
if (!response) return |
|
|
@ -101,8 +105,6 @@ const loadAllTokens = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
loadAllTokens() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This will updated allTokens local value instead of fetching all tokens on each operation (add|delete) |
|
|
|
// This will updated allTokens local value instead of fetching all tokens on each operation (add|delete) |
|
|
|
const updateAllTokens = (type: 'delete' | 'add', token: IApiTokenInfo) => { |
|
|
|
const updateAllTokens = (type: 'delete' | 'add', token: IApiTokenInfo) => { |
|
|
|
switch (type) { |
|
|
|
switch (type) { |
|
|
@ -130,7 +132,7 @@ const deleteToken = async (token: string): Promise<void> => { |
|
|
|
await loadTokens() |
|
|
|
await loadTokens() |
|
|
|
|
|
|
|
|
|
|
|
updateAllTokens('delete', { |
|
|
|
updateAllTokens('delete', { |
|
|
|
token: token, |
|
|
|
token, |
|
|
|
} as IApiTokenInfo) |
|
|
|
} as IApiTokenInfo) |
|
|
|
|
|
|
|
|
|
|
|
if (!tokens.value.length && currentPage.value !== 1) { |
|
|
|
if (!tokens.value.length && currentPage.value !== 1) { |
|
|
|