move trash related types to types/trash
This commit is contained in:
parent
79f6ebc454
commit
4011b6fbe8
|
@ -87,8 +87,9 @@ import {
|
||||||
getLocalTrash,
|
getLocalTrash,
|
||||||
getTrashedFiles,
|
getTrashedFiles,
|
||||||
syncTrash,
|
syncTrash,
|
||||||
Trash,
|
|
||||||
} from 'services/trashService';
|
} from 'services/trashService';
|
||||||
|
import { Trash } from 'types/trash';
|
||||||
|
|
||||||
import DeleteBtn from 'components/DeleteBtn';
|
import DeleteBtn from 'components/DeleteBtn';
|
||||||
import FixCreationTime, {
|
import FixCreationTime, {
|
||||||
FixCreationTimeAttributes,
|
FixCreationTimeAttributes,
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { getCollection } from './collectionService';
|
||||||
import { EnteFile } from 'types/file';
|
import { EnteFile } from 'types/file';
|
||||||
|
|
||||||
import HTTPService from './HTTPService';
|
import HTTPService from './HTTPService';
|
||||||
|
import { Trash, TrashItem } from 'types/trash';
|
||||||
|
|
||||||
const TRASH = 'file-trash';
|
const TRASH = 'file-trash';
|
||||||
const TRASH_TIME = 'trash-time';
|
const TRASH_TIME = 'trash-time';
|
||||||
|
@ -16,16 +17,6 @@ const DELETED_COLLECTION = 'deleted-collection';
|
||||||
|
|
||||||
const ENDPOINT = getEndpoint();
|
const ENDPOINT = getEndpoint();
|
||||||
|
|
||||||
export interface TrashItem {
|
|
||||||
file: EnteFile;
|
|
||||||
isDeleted: boolean;
|
|
||||||
isRestored: boolean;
|
|
||||||
deleteBy: number;
|
|
||||||
createdAt: number;
|
|
||||||
updatedAt: number;
|
|
||||||
}
|
|
||||||
export type Trash = TrashItem[];
|
|
||||||
|
|
||||||
export async function getLocalTrash() {
|
export async function getLocalTrash() {
|
||||||
const trash = (await localForage.getItem<Trash>(TRASH)) || [];
|
const trash = (await localForage.getItem<Trash>(TRASH)) || [];
|
||||||
return trash;
|
return trash;
|
||||||
|
|
11
src/types/trash/index.ts
Normal file
11
src/types/trash/index.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { EnteFile } from 'types/file';
|
||||||
|
|
||||||
|
export interface TrashItem {
|
||||||
|
file: EnteFile;
|
||||||
|
isDeleted: boolean;
|
||||||
|
isRestored: boolean;
|
||||||
|
deleteBy: number;
|
||||||
|
createdAt: number;
|
||||||
|
updatedAt: number;
|
||||||
|
}
|
||||||
|
export type Trash = TrashItem[];
|
Loading…
Reference in a new issue