refactor: migrate direct fetch calls to API handler pattern
Replace raw fetch() in settings, share-key, and import-shared with centralized API handlers via src/lib/api.ts. Also auto-create the data/ directory on startup so the SQLite db path is always valid. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
362f6d861b
commit
eafb44a4e9
9 files changed
+91
-62
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import { IMPORT_SHARED_PATH, IMPORT_SHARED_UPLOAD_ALL_PATH } from "@/config/routes";
|
||||
import API from "@/lib/api";
|
||||
|
||||
export const importShared = async (link: string) => {
|
||||
return API.post(IMPORT_SHARED_PATH, { link });
|
||||
};
|
||||
|
||||
export const importSharedUploadAll = async (params: {
|
||||
origin: string;
|
||||
key: string;
|
||||
assets: object[];
|
||||
albumOptions: object;
|
||||
}) => {
|
||||
return API.post(IMPORT_SHARED_UPLOAD_ALL_PATH, params);
|
||||
};
|
||||
Reference in new issue
Block a user