Explorar el Código

Fix creating anonymous links

poeti8 hace 6 años
padre
commit
21a581ae87
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      server/db/link.ts

+ 2 - 1
server/db/link.ts

@@ -19,7 +19,8 @@ interface CreateLink extends Link {
 }
 
 export const createShortLink = async (data: CreateLink, user: UserJoined) => {
-  const { id: user_id, domain, domain_id } = user;
+  const { id: user_id = null, domain, domain_id = null } =
+    user || ({} as UserJoined);
   let password;
 
   if (data.password) {