feat(auth): refactor sign-out functionality and update import paths

This commit is contained in:
Nils-Johan Gynther
2026-04-17 19:58:45 +02:00
parent ce0cc6fbf0
commit e06d05e8db
3 changed files with 11 additions and 8 deletions
+3 -7
View File
@@ -1,5 +1,6 @@
import Link from 'next/link'; import Link from 'next/link';
import { auth, signOut } from '../auth'; import { auth } from '../auth';
import { signOutAction } from './actions/auth-actions';
const linkStyle: React.CSSProperties = { const linkStyle: React.CSSProperties = {
padding: '0.5rem 0.75rem', padding: '0.5rem 0.75rem',
@@ -41,12 +42,7 @@ export default async function Navigation() {
<span style={{ fontSize: '0.9rem', color: '#555' }}> <span style={{ fontSize: '0.9rem', color: '#555' }}>
👤 {session.user.name} 👤 {session.user.name}
</span> </span>
<form <form action={signOutAction}>
action={async () => {
'use server';
await signOut({ redirectTo: '/login' });
}}
>
<button <button
type="submit" type="submit"
style={{ style={{
+7
View File
@@ -0,0 +1,7 @@
'use server';
import { signOut } from '../../auth';
export async function signOutAction() {
await signOut({ redirectTo: '/login' });
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { auth } from '../../auth'; import { auth } from '../auth';
/** /**
* Returnerar Authorization-header med JWT från sessionen. * Returnerar Authorization-header med JWT från sessionen.