Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
update token api to use SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyione committed Jul 21, 2020
1 parent 8cc67c0 commit 04ca510
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions src/webportal/src/app/user/fabric/conn.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,39 +156,18 @@ export const getUserRequest = async username => {
};

export const getTokenRequest = async () => {
const url = `${config.restServerUri}/api/v1/token`;
const token = checkToken();
return fetchWrapper(url, {
headers: {
Authorization: `Bearer ${token}`,
},
});
return wrapper(() => client.token.getTokens());
};

export const revokeTokenRequest = async token => {
const url = `${config.restServerUri}/api/v1/token/${token}`;
const currentToken = checkToken();
await fetchWrapper(url, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${currentToken}`,
},
});
await wrapper(() => client.token.deleteToken(token));
if (token === checkToken()) {
clearToken();
}
};

export const createApplicationTokenRequest = async () => {
const url = `${config.restServerUri}/api/v1/token/application`;
const currentToken = checkToken();
await fetchWrapper(url, {
method: 'POST',
headers: {
Authorization: `Bearer ${currentToken}`,
},
});
};
export const createApplicationTokenRequest = () =>
client.token.createApplicationToken();

export const listStorageDetailRequest = async () => {
return wrapper(async () => {
Expand Down

0 comments on commit 04ca510

Please sign in to comment.