You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
779 B

import { getProfileRow, parseSocialLinksJson } from "#server/service/profile";
export default defineWrappedResponseHandler(async (event) => {
const user = await event.context.auth.requireUser();
const row = await getProfileRow(user.id);
if (!row) {
throw createError({ statusCode: 404, statusMessage: "未找到" });
}
return R.success({
profile: {
id: row.id,
username: row.username,
email: row.email,
nickname: row.nickname,
avatar: row.avatar,
avatarVisibility: row.avatarVisibility,
bioMarkdown: row.bioMarkdown,
bioVisibility: row.bioVisibility,
socialLinks: parseSocialLinksJson(row.socialLinksJson),
publicSlug: row.publicSlug,
role: row.role,
status: row.status,
},
});
});