Incluindo exibição de informações de contato no perfil
This commit is contained in:
@@ -68,4 +68,12 @@ export async function update(userData: UpdateUserRequest) {
|
||||
|
||||
const response = await instance.patch(userRoutes.update.url, userData, { headers: header });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
// TODO, continuar
|
||||
export async function getSocialInfo(userId: string) {
|
||||
updateHeader();
|
||||
|
||||
const response = await instance.get(userRoutes.getSocialInfo.url + `/${userId}`, { headers: header });
|
||||
return response.data;
|
||||
}
|
||||
@@ -50,4 +50,40 @@ const getById = async (userId: string): Promise<getByIdReturn> => {
|
||||
}
|
||||
};
|
||||
|
||||
export default { getById }
|
||||
interface getByIdReturn {
|
||||
data?: {
|
||||
phone: '',
|
||||
whatsapp: '',
|
||||
facebook: '',
|
||||
telegram: '',
|
||||
},
|
||||
error?: {
|
||||
errorMessage: string;
|
||||
}
|
||||
}
|
||||
|
||||
const getUserSocialInfo = async (userId: string): Promise<getByIdReturn> => {
|
||||
try {
|
||||
let res: getByIdRes = await usersRoutes.getSocialInfo(userId)
|
||||
|
||||
if (res.status === "error") {
|
||||
return {
|
||||
error: {
|
||||
errorMessage: res.message,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
userData: res.data,
|
||||
};
|
||||
} catch(err) {
|
||||
return {
|
||||
error: {
|
||||
errorMessage: "Por favor, autentique-se.",
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export default { getById, getUserSocialInfo }
|
||||
Reference in New Issue
Block a user