mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
27 lines
502 B
TypeScript
27 lines
502 B
TypeScript
import { functions } from "./index";
|
|
|
|
export enum CLOUD_FUNCTIONS {
|
|
updateAlgoliaRecord = "updateAlgoliaRecord",
|
|
deleteAlgoliaRecord = "deleteAlgoliaRecord",
|
|
}
|
|
|
|
export const cloudFunction = (
|
|
name: string,
|
|
input: any,
|
|
success: Function,
|
|
fail: Function
|
|
) => {
|
|
const callable = functions.httpsCallable(name);
|
|
callable(input)
|
|
.then(result => {
|
|
if (success) {
|
|
success(result);
|
|
}
|
|
})
|
|
.catch(error => {
|
|
if (fail) {
|
|
fail(error);
|
|
}
|
|
});
|
|
};
|