2022-04-25 15:15:17 +02:00
|
|
|
import axios from "axios";
|
|
|
|
import { AppwriteFileWithPreview } from "../types/File.type";
|
|
|
|
|
|
|
|
const get = async (shareId: string, password?: string) => {
|
|
|
|
return (
|
2022-04-25 17:11:41 +02:00
|
|
|
await axios.post(`/api/share/${shareId}`, { password })
|
2022-04-25 15:15:17 +02:00
|
|
|
).data as AppwriteFileWithPreview[];
|
|
|
|
};
|
|
|
|
|
|
|
|
const authenticateWithPassword = async (shareId: string, password?: string) => {
|
|
|
|
return (
|
|
|
|
await axios.post(
|
2022-04-25 17:11:41 +02:00
|
|
|
`/api/share/${shareId}/enterPassword`,
|
2022-04-25 15:15:17 +02:00
|
|
|
{ password }
|
|
|
|
)
|
|
|
|
).data as AppwriteFileWithPreview[];
|
|
|
|
};
|
|
|
|
|
|
|
|
export default { get, authenticateWithPassword };
|