Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rest/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getProfile } from "./profile.ts";
// scrapbox.io内なら`window._csrf`にCSRF tokenが入っている
declare global {
interface Window {
__csrf?: string;
_csrf?: string;
}
}

Expand All @@ -22,7 +22,7 @@ export type Result<T, E> = { ok: true; value: T } | { ok: false; value: E };
export async function getCSRFToken(
sid?: string,
): Promise<string> {
if (window.__csrf) return window.__csrf;
if (window._csrf) return window._csrf;

const user = await getProfile(sid ? { sid } : undefined);
return user.csrfToken;
Expand Down