Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

feat(demo): add mock handlers for share links endpoints (#1132)

Corentin Thomassetfed60f013ed2
diff --git a/apps/papra-client/src/modules/demo/demo-api-mock.ts b/apps/papra-client/src/modules/demo/demo-api-mock.ts
index bde12cf3..72b8d52f 100644
--- a/apps/papra-client/src/modules/demo/demo-api-mock.ts
+++ b/apps/papra-client/src/modules/demo/demo-api-mock.ts
@@ -1282,6 +1282,34 @@ const inMemoryApiMock: Record<string, { handler: any }> = {
await documentCustomPropertyValueStorage.removeItem(valueKey);
},
}),
+
+ ...defineHandler({
+ path: '/api/organizations/:organizationId/share-links',
+ method: 'GET',
+ handler: async () => ({ shareLinks: [] }),
+ }),
+
+ ...defineHandler({
+ path: '/api/organizations/:organizationId/documents/:documentId/share-links',
+ method: 'GET',
+ handler: async () => ({ shareLinks: [] }),
+ }),
+
+ ...defineHandler({
+ path: '/api/organizations/:organizationId/documents/:documentId/share-links',
+ method: 'POST',
+ handler: async () => {
+ throw Object.assign(new FetchError('Not available in demo'), {
+ status: 501,
+ data: {
+ error: {
+ message: 'Share links are not available in demo',
+ code: 'demo.not_available',
+ },
+ },
+ });
+ },
+ }),
};
export const router = createRouter({ routes: inMemoryApiMock, strictTrailingSlash: false });