Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1x | import Axios, { AxiosResponse } from "axios"; import { hostname, userPath } from "./api"; import store from "../redux/store"; import {updateUser} from "../redux/actions/user"; import {UserState} from "../redux/actions/userTypes"; export interface UserInformation { userId: number | null; username?: string | null; groups?: number[]|null; password?: string; confirmationPassword?: string; } export const changeUserInformation = (userWithNewInformation: UserInformation): Promise<UserState> => { console.log("[API] userinformation: User given to update user api:") console.log(userWithNewInformation) return new Promise((resolve, reject) => { return Axios.put(`${hostname}${userPath}/${userWithNewInformation.userId}/edit`, userWithNewInformation) .then((response: AxiosResponse<UserState>) => { store.dispatch(updateUser(JSON.parse(response.config.data))); resolve(response.data) }) .catch((error) => { reject(error.response?.data?.message); }); }) }; |