Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.9 KB
Raw Blame
import { MakeLogicType, actions, kea, key, path, props } from 'kea'
import { loaders } from 'kea-loaders'

import api from 'lib/api'

import { LinearTeamType } from '~/types'

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface linearIntegrationLogicValues {
    linearTeams: LinearTeamType[]
    linearTeamsLoading: boolean
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface linearIntegrationLogicActions {
    loadAllLinearTeams: () => {}
    loadAllLinearTeamsFailure: (
        error: string,
        errorObject?: any
    ) => {
        error: string
        errorObject?: any
    }
    loadAllLinearTeamsSuccess: (
        linearTeams: LinearTeamType[],
        payload?: {}
    ) => {
        linearTeams: LinearTeamType[]
        payload?: {}
    }
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface linearIntegrationLogicProps {
    id: number
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface linearIntegrationLogicMeta {
    key: number
}

export type linearIntegrationLogicType = MakeLogicType<
    linearIntegrationLogicValues,
    linearIntegrationLogicActions,
    linearIntegrationLogicProps,
    linearIntegrationLogicMeta
>

export const linearIntegrationLogic = kea<linearIntegrationLogicType>([
    props({} as { id: number }),
    key((props) => props.id),
    path((key) => ['lib', 'integrations', 'linearIntegrationLogic', key]),
    actions({
        loadAllLinearTeams: () => ({}),
    }),

    loaders(({ props }) => ({
        linearTeams: [
            [] as LinearTeamType[],
            {
                loadAllLinearTeams: async () => {
                    const res = await api.integrations.linearTeams(props.id)
                    return res.teams
                },
            },
        ],
    })),
])