costco-grocery-list/frontend/src/api/users.js
Nico 1281c91c28
All checks were successful
Build & Deploy Costco Grocery List / build (push) Successful in 13s
Build & Deploy Costco Grocery List / deploy (push) Successful in 6s
Build & Deploy Costco Grocery List / notify (push) Successful in 1s
add password and display name manipulation
2026-01-24 21:38:33 -08:00

18 lines
713 B
JavaScript

import api from "./axios";
export const getAllUsers = () => api.get("/admin/users");
export const updateRole = (id, role) => api.put(`/admin/users`, { id, role });
export const deleteUser = (id) => api.delete(`/admin/users/${id}`);
export const checkIfUserExists = (username) => api.get(`/users/exists`, { params: { username: username } });
export const getCurrentUser = async () => {
return api.get("/users/me");
};
export const updateCurrentUser = async (display_name) => {
return api.patch("/users/me", { display_name });
};
export const changePassword = async (current_password, new_password) => {
return api.post("/users/me/change-password", { current_password, new_password });
};