Use server actions instead of client-side API calls
This commit is contained in:
parent
5a3127dcb0
commit
aa453954ed
30 changed files with 703 additions and 462 deletions
|
|
@ -121,16 +121,23 @@ export const authOptions: NextAuthOptions = {
|
|||
session.user.roles = token.roles ?? [];
|
||||
// @ts-ignore
|
||||
session.user.leafcutter = token.leafcutter; // remove
|
||||
// @ts-ignore
|
||||
session.user.zammadCsrfToken = token.zammadCsrfToken;
|
||||
|
||||
return session;
|
||||
},
|
||||
jwt: async ({ token, user, account, profile, trigger }) => {
|
||||
jwt: async ({ token, user, account, profile, trigger, session }) => {
|
||||
if (user) {
|
||||
token.roles = (await getUserRoles(user.email)) ?? [];
|
||||
}
|
||||
|
||||
if (session && trigger === "update") {
|
||||
token.zammadCsrfToken = session.csrfToken;
|
||||
}
|
||||
return token;
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const getServerSession = (
|
||||
...args:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue