Adicionando dinamica status de perfil do usuário
This commit is contained in:
@@ -73,6 +73,13 @@ export async function update(userData: UpdateUserRequest) {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function checkIfUserIsDriver(id_user: string) {
|
||||
updateHeader();
|
||||
|
||||
const response = await instance.get(userRoutes.checkIfUserIsDriver.url + `/${id_user}`, { headers: header });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
// TODO, continuar
|
||||
export async function getSocialInfo(userId: string) {
|
||||
updateHeader();
|
||||
|
||||
@@ -92,4 +92,44 @@ const getUserSocialInfo = async (userId: string): Promise<getByIdReturn> => {
|
||||
}
|
||||
};
|
||||
|
||||
export default { getById, getUserSocialInfo }
|
||||
interface checkIfUserIsDriverReturn {
|
||||
result?: boolean;
|
||||
error?: {
|
||||
errorMessage: string;
|
||||
}
|
||||
}
|
||||
|
||||
interface checkIfUserIsDriverResponse {
|
||||
status: string;
|
||||
message: string;
|
||||
result?: boolean;
|
||||
error?: {
|
||||
errorMessage: string;
|
||||
}
|
||||
}
|
||||
|
||||
const checkIfUserIsDriver = async (id_user: string): Promise<checkIfUserIsDriverReturn> => {
|
||||
try {
|
||||
let res: checkIfUserIsDriverResponse = await usersRoutes.checkIfUserIsDriver(id_user)
|
||||
|
||||
if (res.status === "error") {
|
||||
return {
|
||||
error: {
|
||||
errorMessage: res.message,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
result: res.result,
|
||||
};
|
||||
} catch(err) {
|
||||
return {
|
||||
error: {
|
||||
errorMessage: "Por favor, autentique-se.",
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export default { getById, getUserSocialInfo, checkIfUserIsDriver }
|
||||
Reference in New Issue
Block a user