Changeset be22289 for server


Ignore:
Timestamp:
01/29/26 03:53:28 (5 months ago)
Author:
Tome <gjorgievtome@…>
Branches:
main
Children:
b348db4
Parents:
adc31ef
Message:

Minor refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/telefunc/ctx.ts

    radc31ef rbe22289  
    1010    const n = Number(sessionUserId);
    1111    return Number.isInteger(n) && n > 0 ? n : undefined;
    12 }
    13 
    14 export function requireUser() {
    15     const c = ctx();
    16     const userId = parseSessionUserId(c.session?.user?.id);
    17     if (!userId) throw Abort();
    18     return { c, userId };
    1912}
    2013
     
    3124}
    3225
     26export function requireUser() {
     27    const c = ctx();
     28    const userId = parseSessionUserId(c.session?.user?.id);
     29    if (!userId) throw Abort();
     30    return { c, userId };
     31}
     32
    3333export async function requireAdmin() {
    3434    const { c, userId } = requireUser();
    35 
    3635
    3736    if(!c.session?.user?.isAdmin) throw Abort();
Note: See TracChangeset for help on using the changeset viewer.