Files
outline/app/models/Integration.ts
Tom Moor 15b1069bcc chore: Move to Typescript (#2783)
This PR moves the entire project to Typescript. Due to the ~1000 ignores this will lead to a messy codebase for a while, but the churn is worth it – all of those ignore comments are places that were never type-safe previously.

closes #1282
2021-11-29 06:40:55 -08:00

42 lines
737 B
TypeScript

import { extendObservable, action } from "mobx";
import BaseModel from "~/models/BaseModel";
import { client } from "~/utils/ApiClient";
type Settings = {
url: string;
channel: string;
channelId: string;
};
type Events = "documents.create" | "collections.create";
class Integration extends BaseModel {
id: string;
type: string;
service: string;
collectionId: string;
events: Events;
settings: Settings;
@action
update = async (data: Record<string, any>) => {
await client.post("/integrations.update", {
id: this.id,
...data,
});
extendObservable(this, data);
return true;
};
@action
delete = () => {
return this.store.delete(this);
};
}
export default Integration;