0
Fork 0
mirror of https://github.com/stonith404/pingvin-share.git synced 2025-02-05 01:38:56 -05:00
pingvin-share/src/services/share.service.ts
2022-04-28 16:01:50 +02:00

18 lines
680 B
TypeScript

import axios from "axios";
import { AppwriteFileWithPreview } from "../types/File.type";
const get = async (shareId: string, password?: string) => {
return (await axios.post(`/api/share/${shareId}`, { password }))
.data as AppwriteFileWithPreview[];
};
const isIdAlreadyInUse = async (shareId: string) => {
return (await axios.get(`/api/share/${shareId}/exists`)).data
.exists as boolean;
};
const authenticateWithPassword = async (shareId: string, password?: string) => {
return (await axios.post(`/api/share/${shareId}/enterPassword`, { password }))
.data as AppwriteFileWithPreview[];
};
export default { get, authenticateWithPassword, isIdAlreadyInUse };