removal of redundant pages
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
import { ID, Response } from "../../../../../_digifi/helpers";
|
||||
export type User = {
|
||||
id?: ID;
|
||||
name?: string;
|
||||
avatar?: string;
|
||||
// email?: string
|
||||
position?: string;
|
||||
role?: string;
|
||||
last_login?: string;
|
||||
two_steps?: boolean;
|
||||
joined_day?: string;
|
||||
online?: boolean;
|
||||
initials?: {
|
||||
label: string;
|
||||
state: string;
|
||||
};
|
||||
firstname?: string;
|
||||
lastname?: string;
|
||||
uid?: string;
|
||||
loan_amount?: string;
|
||||
payment_month?: string;
|
||||
sales_agent?: string;
|
||||
gender?: string | null;
|
||||
marital_status?: string;
|
||||
email?: string;
|
||||
address?: string;
|
||||
state?: string;
|
||||
country?: string;
|
||||
status?: string;
|
||||
added?: string;
|
||||
updated?: string;
|
||||
};
|
||||
|
||||
export type UsersQueryResponse = Response<Array<User>>;
|
||||
|
||||
export const initialUser: User = {
|
||||
avatar: "avatars/300-6.jpg",
|
||||
position: "Art Director",
|
||||
role: "Administrator",
|
||||
name: "",
|
||||
email: "",
|
||||
};
|
||||
@@ -1,60 +0,0 @@
|
||||
import axios, { AxiosResponse } from "axios";
|
||||
import { ID, Response } from "../../../../../_digifi/helpers";
|
||||
import { User, UsersQueryResponse } from "./_models";
|
||||
|
||||
const API_URL = import.meta.env.VITE_APP_THEME_API_URL;
|
||||
const USER_URL = `${API_URL}/user`;
|
||||
// const GET_USERS_URL = `${API_URL}/users/query`;
|
||||
|
||||
const NEW_USER_ENDPOINT = import.meta.env.VITE_APP_USER_ENDPOINT;
|
||||
|
||||
// const getStartedUsers = (query: string): Promise<UsersQueryResponse> => {
|
||||
// return axios
|
||||
// .get(`${GET_USERS_URL}?${query}`)
|
||||
// .then((d: AxiosResponse<UsersQueryResponse>) => d.data);
|
||||
// };
|
||||
const getStartedUsers = (query: string): Promise<UsersQueryResponse> => {
|
||||
// FUNCTION TO GET USERS THAT HAVE STARTED LOAN APPLICATION
|
||||
return axios
|
||||
.get(`${NEW_USER_ENDPOINT}/loan/started`)
|
||||
.then((d: AxiosResponse<UsersQueryResponse>) => d.data);
|
||||
};
|
||||
|
||||
const getUserById = (id: ID): Promise<User | undefined> => {
|
||||
return axios
|
||||
.get(`${USER_URL}/${id}`)
|
||||
.then((response: AxiosResponse<Response<User>>) => response.data)
|
||||
.then((response: Response<User>) => response.data);
|
||||
};
|
||||
|
||||
const createUser = (user: User): Promise<User | undefined> => {
|
||||
return axios
|
||||
.put(USER_URL, user)
|
||||
.then((response: AxiosResponse<Response<User>>) => response.data)
|
||||
.then((response: Response<User>) => response.data);
|
||||
};
|
||||
|
||||
const updateUser = (user: User): Promise<User | undefined> => {
|
||||
return axios
|
||||
.post(`${USER_URL}/${user.id}`, user)
|
||||
.then((response: AxiosResponse<Response<User>>) => response.data)
|
||||
.then((response: Response<User>) => response.data);
|
||||
};
|
||||
|
||||
const deleteUser = (userId: ID): Promise<void> => {
|
||||
return axios.delete(`${USER_URL}/${userId}`).then(() => {});
|
||||
};
|
||||
|
||||
const deleteSelectedUsers = (userIds: Array<ID>): Promise<void> => {
|
||||
const requests = userIds.map((id) => axios.delete(`${USER_URL}/${id}`));
|
||||
return axios.all(requests).then(() => {});
|
||||
};
|
||||
|
||||
export {
|
||||
getStartedUsers,
|
||||
deleteUser,
|
||||
deleteSelectedUsers,
|
||||
getUserById,
|
||||
createUser,
|
||||
updateUser,
|
||||
};
|
||||
Reference in New Issue
Block a user