wip
This commit is contained in:
@@ -10,10 +10,10 @@ interface getByIdReturn {
|
||||
bio: string;
|
||||
document_type: string;
|
||||
document: string;
|
||||
},
|
||||
};
|
||||
error?: {
|
||||
errorMessage: string;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
interface getByIdRes {
|
||||
@@ -29,65 +29,67 @@ interface getByIdRes {
|
||||
bio: string;
|
||||
document_type: string;
|
||||
document: string;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const getById = async (userId: string): Promise<getByIdReturn> => {
|
||||
export const getById = async (userId: string): Promise<getByIdReturn> => {
|
||||
try {
|
||||
let res: getByIdRes = await usersRoutes.getById(userId)
|
||||
let res: getByIdRes = await usersRoutes.getById(userId);
|
||||
|
||||
if (res.status === "error") {
|
||||
return {
|
||||
error: {
|
||||
errorMessage: res.message,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
userData: res.data,
|
||||
};
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return {
|
||||
error: {
|
||||
errorMessage: "Por favor, autentique-se.",
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
interface getByIdReturn {
|
||||
data?: {
|
||||
phone: '',
|
||||
whatsapp: '',
|
||||
facebook: '',
|
||||
telegram: '',
|
||||
},
|
||||
phone: "";
|
||||
whatsapp: "";
|
||||
facebook: "";
|
||||
telegram: "";
|
||||
};
|
||||
error?: {
|
||||
errorMessage: string;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const getUserSocialInfo = async (userId: string): Promise<getByIdReturn> => {
|
||||
export const getUserSocialInfo = async (
|
||||
userId: string
|
||||
): Promise<getByIdReturn> => {
|
||||
try {
|
||||
let res: getByIdRes = await usersRoutes.getSocialInfo(userId)
|
||||
let res: getByIdRes = await usersRoutes.getSocialInfo(userId);
|
||||
|
||||
if (res.status === "error") {
|
||||
return {
|
||||
error: {
|
||||
errorMessage: res.message,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
userData: res.data,
|
||||
};
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return {
|
||||
error: {
|
||||
errorMessage: "Por favor, autentique-se.",
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -96,7 +98,7 @@ interface checkIfUserIsDriverReturn {
|
||||
result?: boolean;
|
||||
error?: {
|
||||
errorMessage: string;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
interface checkIfUserIsDriverResponse {
|
||||
@@ -105,31 +107,32 @@ interface checkIfUserIsDriverResponse {
|
||||
result?: boolean;
|
||||
error?: {
|
||||
errorMessage: string;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const checkIfUserIsDriver = async (id_user: string): Promise<checkIfUserIsDriverReturn> => {
|
||||
export const checkIfUserIsDriver = async (
|
||||
id_user: string
|
||||
): Promise<checkIfUserIsDriverReturn> => {
|
||||
try {
|
||||
let res: checkIfUserIsDriverResponse = await usersRoutes.checkIfUserIsDriver(id_user)
|
||||
let res: checkIfUserIsDriverResponse =
|
||||
await usersRoutes.checkIfUserIsDriver(id_user);
|
||||
|
||||
if (res.status === "error") {
|
||||
return {
|
||||
error: {
|
||||
errorMessage: res.message,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
result: res.result,
|
||||
};
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return {
|
||||
error: {
|
||||
errorMessage: "Por favor, autentique-se.",
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export default { getById, getUserSocialInfo, checkIfUserIsDriver }
|
||||
Reference in New Issue
Block a user