Sfoglia il codice sorgente

Fix creating anonymous links

poeti8 6 anni fa
parent
commit
21a581ae87
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  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) {