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

[webportal] Update token API #4753

Merged
merged 1 commit into from
Jul 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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