@@ -2,6 +2,9 @@ import { type Handlers } from "$fresh/server.ts";
22import { keys , mergeHeaders , SecureCookieMap , STORE_NAMES } from "$utils/cookies.ts" ;
33import { LOCAL_STORES , localStores } from "$utils/kv.ts" ;
44import { state } from "$utils/state.ts" ;
5+ import { getLogger } from "$utils/logs.ts" ;
6+
7+ const logger = getLogger ( [ "kview" , "api" , "local" ] ) ;
58
69async function setName (
710 value : string ,
@@ -24,6 +27,7 @@ async function setName(
2427export const handler : Handlers = {
2528 async POST ( req ) {
2629 const [ id , value ] : [ string , string ] = await req . json ( ) ;
30+ logger . debug ( "POST: {id} = {value}" , { id, value } ) ;
2731 const cookies = await setName ( value , id , req ) ;
2832 return new Response ( null , {
2933 status : 204 ,
@@ -39,6 +43,12 @@ export const handler: Handlers = {
3943 previousPath ?: string ;
4044 name ?: string ;
4145 } = await req . json ( ) ;
46+ logger . debug ( "PUT: {id} = {name}, path: {path}, previousPath: {previousPath}" , {
47+ id,
48+ name,
49+ path,
50+ previousPath,
51+ } ) ;
4252 if ( path ) {
4353 const { isFile } = await Deno . stat ( path ) ;
4454 if ( isFile ) {
@@ -75,6 +85,7 @@ export const handler: Handlers = {
7585 async DELETE ( req ) {
7686 try {
7787 const { path } : { path : string } = await req . json ( ) ;
88+ logger . debug ( "DELETE: {path}" , { path } ) ;
7889 const localStoresString = localStorage . getItem ( LOCAL_STORES ) ;
7990 if ( localStoresString ) {
8091 const stores : string [ ] = JSON . parse ( localStoresString ) ;
0 commit comments