diff --git a/src/public/app/services/protected_session_holder.js b/src/public/app/services/protected_session_holder.ts similarity index 88% rename from src/public/app/services/protected_session_holder.js rename to src/public/app/services/protected_session_holder.ts index 8fdae303c..9b0287999 100644 --- a/src/public/app/services/protected_session_holder.js +++ b/src/public/app/services/protected_session_holder.ts @@ -1,3 +1,4 @@ +import FNote from "../entities/fnote.js"; import server from "./server.js"; function enableProtectedSession() { @@ -20,7 +21,7 @@ async function touchProtectedSession() { } } -function touchProtectedSessionIfNecessary(note) { +function touchProtectedSessionIfNecessary(note: FNote) { if (note && note.isProtected && isProtectedSessionAvailable()) { touchProtectedSession(); } diff --git a/src/public/app/services/server.ts b/src/public/app/services/server.ts index c24bb86f7..bfa5fc993 100644 --- a/src/public/app/services/server.ts +++ b/src/public/app/services/server.ts @@ -58,7 +58,7 @@ async function get(url: string, componentId?: string) { return await call('GET', url, componentId); } -async function post(url: string, data: unknown, componentId?: string) { +async function post(url: string, data?: unknown, componentId?: string) { return await call('POST', url, componentId, { data }); } diff --git a/src/public/app/types.d.ts b/src/public/app/types.d.ts index 9934211e9..62d507c80 100644 --- a/src/public/app/types.d.ts +++ b/src/public/app/types.d.ts @@ -24,6 +24,7 @@ interface CustomGlobals { componentId: string; csrfToken: string; baseApiUrl: string; + isProtectedSessionAvailable: boolean; } type RequireMethod = (moduleName: string) => any;