File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -81,8 +81,8 @@ export function InvoiceCreator({
81
81
defaultValues : {
82
82
invoiceNumber : generateInvoiceNumber ( invoiceCount ) ,
83
83
dueDate : "" ,
84
- creatorName : ! isInvoiceMe ? ( currentUser ?. name ?? "" ) : "" ,
85
- creatorEmail : ! isInvoiceMe ? ( currentUser ?. email ?? "" ) : "" ,
84
+ creatorName : currentUser ?. name ?? "" ,
85
+ creatorEmail : currentUser ?. email ?? "" ,
86
86
clientName : recipientDetails ?. clientName ?? "" ,
87
87
clientEmail : recipientDetails ?. clientEmail ?? "" ,
88
88
invoicedTo : recipientDetails ?. userId ?? "" ,
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ export const invoiceRouter = router({
148
148
createFromInvoiceMe : publicProcedure
149
149
. input ( invoiceFormSchema )
150
150
. mutation ( async ( { ctx, input } ) => {
151
- const { db } = ctx ;
151
+ const { db, session } = ctx ;
152
152
153
153
if ( ! input . invoicedTo ) {
154
154
throw new TRPCError ( {
@@ -177,7 +177,7 @@ export const invoiceRouter = router({
177
177
{
178
178
...input ,
179
179
} ,
180
- input . invoicedTo as string ,
180
+ session ?. userId || ( input ? .invoicedTo as string ) ,
181
181
) ;
182
182
} ) ;
183
183
} catch ( error ) {
You can’t perform that action at this time.
0 commit comments