List the last visited workspace first in the rail
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { AppData } from "@/src/data/app-data";
|
||||
import type { CookieOptions } from "./cookies";
|
||||
|
||||
type Params = {
|
||||
workspace_id: number | string;
|
||||
/**
|
||||
* From `isSecureRequest`, so plain HTTP over a VPN still keeps it.
|
||||
*/
|
||||
secure: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* The cookie that remembers the workspace this browser was last in, for
|
||||
* `setCookies`: read back by `readLastVisitedWorkspace` in the root, so the
|
||||
* rail lists that workspace first. It never decides where `/admin/bots`
|
||||
* lands. `HttpOnly`, since only the server reads it.
|
||||
*/
|
||||
export default function lastVisitedWorkspaceCookies({ workspace_id, secure }: Params): CookieOptions[] {
|
||||
return [
|
||||
{
|
||||
name: AppData["LastVisitedWorkspaceCookieName"],
|
||||
value: String(workspace_id),
|
||||
secure,
|
||||
maxAge: AppData["LastVisitedCookieMaxAgeSeconds"],
|
||||
},
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user