fix: refactor and implement design

This commit is contained in:
Mythie
2024-02-28 14:43:09 +11:00
parent b225cc8139
commit e3e2cfbcfd
42 changed files with 891 additions and 876 deletions

View File

@ -1,5 +1,6 @@
import { TRPCError } from '@trpc/server';
import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';
import { deleteUser } from '@documenso/lib/server-only/user/delete-user';
import { findUserSecurityAuditLogs } from '@documenso/lib/server-only/user/find-user-security-audit-logs';
import { forgotPassword } from '@documenso/lib/server-only/user/forgot-password';
@ -80,14 +81,20 @@ export const profileRouter = router({
.input(ZUpdatePublicProfileMutationSchema)
.mutation(async ({ input, ctx }) => {
try {
const { profileURL } = input;
const { url } = input;
return await updatePublicProfile({
id: ctx.user.id,
profileURL,
const user = await updatePublicProfile({
userId: ctx.user.id,
url,
});
return { success: true, url: user.url };
} catch (err) {
console.error(err);
const error = AppError.parseError(err);
if (error.code !== AppErrorCode.UNKNOWN_ERROR) {
throw AppError.parseErrorToTRPCError(error);
}
throw new TRPCError({
code: 'BAD_REQUEST',

View File

@ -17,7 +17,7 @@ export const ZUpdateProfileMutationSchema = z.object({
});
export const ZUpdatePublicProfileMutationSchema = z.object({
profileURL: z.string().min(1),
url: z.string().min(1),
});
export const ZUpdatePasswordMutationSchema = z.object({