mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-10 18:39:22 +08:00
client-ts: Port services/protected_session_holder
This commit is contained in:
parent
cf57819b22
commit
65563cb29e
@ -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();
|
||||
}
|
@ -58,7 +58,7 @@ async function get<T>(url: string, componentId?: string) {
|
||||
return await call<T>('GET', url, componentId);
|
||||
}
|
||||
|
||||
async function post<T>(url: string, data: unknown, componentId?: string) {
|
||||
async function post<T>(url: string, data?: unknown, componentId?: string) {
|
||||
return await call<T>('POST', url, componentId, { data });
|
||||
}
|
||||
|
||||
|
1
src/public/app/types.d.ts
vendored
1
src/public/app/types.d.ts
vendored
@ -24,6 +24,7 @@ interface CustomGlobals {
|
||||
componentId: string;
|
||||
csrfToken: string;
|
||||
baseApiUrl: string;
|
||||
isProtectedSessionAvailable: boolean;
|
||||
}
|
||||
|
||||
type RequireMethod = (moduleName: string) => any;
|
||||
|
Loading…
x
Reference in New Issue
Block a user