mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
Remember last team.
This commit is contained in:
parent
1852acc333
commit
ef3f7274e3
3 changed files with 30 additions and 2 deletions
|
|
@ -1,5 +1,21 @@
|
|||
'use client';
|
||||
import { useEffect } from 'react';
|
||||
import { redirect } from 'next/navigation';
|
||||
import { getItem, removeItem } from '@/lib/storage';
|
||||
import { LAST_TEAM_CONFIG } from '@/lib/constants';
|
||||
|
||||
export default function RootPage() {
|
||||
redirect('/websites');
|
||||
useEffect(() => {
|
||||
const lastTeam = getItem(LAST_TEAM_CONFIG);
|
||||
|
||||
if (lastTeam) {
|
||||
redirect(`/teams/${lastTeam}/websites`);
|
||||
} else {
|
||||
removeItem(LAST_TEAM_CONFIG);
|
||||
|
||||
redirect(`/websites`);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue