chore(web): generate API functions with a single argument (#2568)

This commit is contained in:
Sergey Kondrikov 2023-05-28 04:52:22 +03:00 committed by GitHub
parent a460940430
commit 6c6c5ef651
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 1913 additions and 491 deletions

View file

@ -17,8 +17,10 @@
const handleChangePassword = async () => {
try {
await api.authenticationApi.changePassword({
password,
newPassword
changePasswordDto: {
password,
newPassword
}
});
notificationController.show({

View file

@ -29,7 +29,7 @@
}
try {
await api.authenticationApi.logoutAuthDevice(deleteDevice.id);
await api.authenticationApi.logoutAuthDevice({ id: deleteDevice.id });
notificationController.show({ message: `Logged out device`, type: NotificationType.Info });
} catch (error) {
handleError(error, 'Unable to log out device');

View file

@ -15,13 +15,13 @@
onMount(async () => {
// TODO: update endpoint to have a query param for deleted users
let { data: users } = await api.userApi.getAllUsers(false);
let { data: users } = await api.userApi.getAllUsers({ isAll: false });
// remove invalid users
users = users.filter((_user) => !(_user.deletedAt || _user.id === user.id));
// exclude partners from the list of users available for selection
const { data: partners } = await api.partnerApi.getPartners('shared-by');
const { data: partners } = await api.partnerApi.getPartners({ direction: 'shared-by' });
const partnerIds = partners.map((partner) => partner.id);
availableUsers = users.filter((user) => !partnerIds.includes(user.id));
});

View file

@ -16,7 +16,7 @@
let removePartner: UserResponseDto | null = null;
const refreshPartners = async () => {
const { data } = await api.partnerApi.getPartners('shared-by');
const { data } = await api.partnerApi.getPartners({ direction: 'shared-by' });
partners = data;
};
@ -26,7 +26,7 @@
}
try {
await api.partnerApi.removePartner(removePartner.id);
await api.partnerApi.removePartner({ id: removePartner.id });
removePartner = null;
await refreshPartners();
} catch (error) {
@ -37,7 +37,7 @@
const handleCreatePartners = async (users: UserResponseDto[]) => {
try {
for (const user of users) {
await api.partnerApi.createPartner(user.id);
await api.partnerApi.createPartner({ id: user.id });
}
await refreshPartners();

View file

@ -40,7 +40,7 @@
const handleCreate = async (event: CustomEvent<APIKeyResponseDto>) => {
try {
const dto = event.detail;
const { data } = await api.keyApi.createKey(dto);
const { data } = await api.keyApi.createKey({ aPIKeyCreateDto: dto });
secret = data.secret;
} catch (error) {
handleError(error, 'Unable to create a new API Key');
@ -58,7 +58,7 @@
const dto = event.detail;
try {
await api.keyApi.updateKey(editKey.id, { name: dto.name });
await api.keyApi.updateKey({ id: editKey.id, aPIKeyUpdateDto: { name: dto.name } });
notificationController.show({
message: `Saved API Key`,
type: NotificationType.Info
@ -77,7 +77,7 @@
}
try {
await api.keyApi.deleteKey(deleteKey.id);
await api.keyApi.deleteKey({ id: deleteKey.id });
notificationController.show({
message: `Removed API Key: ${deleteKey.name}`,
type: NotificationType.Info

View file

@ -16,10 +16,12 @@
const handleSaveProfile = async () => {
try {
const { data } = await api.userApi.updateUser({
id: user.id,
email: user.email,
firstName: user.firstName,
lastName: user.lastName
updateUserDto: {
id: user.id,
email: user.email,
firstName: user.firstName,
lastName: user.lastName
}
});
Object.assign(user, data);