当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript GetState.default方法代码示例

本文整理汇总了TypeScript中src/types.GetState.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript GetState.default方法的具体用法?TypeScript GetState.default怎么用?TypeScript GetState.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在src/types.GetState的用法示例。


在下文中一共展示了GetState.default方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: dispatch

export const saveVEOView = (dashboard: Dashboard) => async (
  dispatch,
  getState: GetState
): Promise<void> => {
  const view = getSaveableView(getState())

  try {
    if (view.id) {
      await dispatch(updateView(dashboard, view))
    } else {
      await dispatch(createCellWithView(dashboard, view))
    }
  } catch (error) {
    console.error(error)
    dispatch(notify(copy.cellAddFailed()))
  }
}
开发者ID:sebito91,项目名称:influxdb,代码行数:17,代码来源:index.ts

示例2: async

export const getTelegrafs = () => async (dispatch, getState: GetState) => {
  const {
    orgs: {org},
  } = getState()

  try {
    dispatch(setTelegrafs(RemoteDataState.Loading))

    const telegrafs = await client.telegrafConfigs.getAll(org.id)

    dispatch(setTelegrafs(RemoteDataState.Done, telegrafs))
  } catch (e) {
    console.error(e)
    dispatch(setTelegrafs(RemoteDataState.Error))
    dispatch(notify(telegrafGetFailed()))
  }
}
开发者ID:influxdata,项目名称:influxdb,代码行数:17,代码来源:index.ts

示例3: async

) => async (dispatch: Dispatch<Action>, getState: GetState) => {
  const {
    orgs: {org},
  } = getState()

  try {
    const createdLabel = await client.labels.create({
      orgID: org.id,
      name,
      properties,
    })

    dispatch(addLabel(createdLabel))
  } catch (e) {
    console.error(e)
    dispatch(notify(createLabelFailed()))
  }
}
开发者ID:influxdata,项目名称:influxdb,代码行数:18,代码来源:index.ts

示例4: async

export const getVariables = () => async (
  dispatch: Dispatch<Action>,
  getState: GetState
) => {
  try {
    dispatch(setVariables(RemoteDataState.Loading))
    const {
      orgs: {org},
    } = getState()
    const variables = await client.variables.getAll(org.id)

    dispatch(setVariables(RemoteDataState.Done, variables))
  } catch (e) {
    console.error(e)
    dispatch(setVariables(RemoteDataState.Error))
    dispatch(notify(getVariablesFailed()))
  }
}
开发者ID:sebito91,项目名称:influxdb,代码行数:18,代码来源:index.ts

示例5: async

export const getAuthorizations = () => async (
  dispatch: Dispatch<Action | NotificationAction>,
  getState: GetState
) => {
  try {
    dispatch(setAuthorizations(RemoteDataState.Loading))
    const {
      orgs: {org},
    } = getState()

    const authorizations = await client.authorizations.getAll(org.id)

    dispatch(setAuthorizations(RemoteDataState.Done, authorizations))
  } catch (e) {
    console.error(e)
    dispatch(setAuthorizations(RemoteDataState.Error))
    dispatch(notify(authorizationsGetFailed()))
  }
}
开发者ID:influxdata,项目名称:influxdb,代码行数:19,代码来源:index.ts

示例6: async

export const getUsers = () => async (
  dispatch: Dispatch<Action>,
  getState: GetState
) => {
  try {
    const {
      members: {list},
    } = getState()

    const apiUsers = await client.users.getAll()
    const allUsers = apiUsers.reduce((acc, u) => _.set(acc, u.id, u), {})
    const users = _.omit(allUsers, list.map(m => m.id))

    dispatch(setUsers(RemoteDataState.Done, users))
  } catch (e) {
    console.error(e)
    dispatch(setMembers(RemoteDataState.Error))
  }
}
开发者ID:influxdata,项目名称:influxdb,代码行数:19,代码来源:index.ts

示例7: async

export const getScrapers = () => async (
  dispatch: Dispatch<Action>,
  getState: GetState
) => {
  try {
    const {
      orgs: {org},
    } = getState()

    dispatch(setScrapers(RemoteDataState.Loading))

    const scrapers = await client.scrapers.getAll(org.id)

    dispatch(setScrapers(RemoteDataState.Done, scrapers))
  } catch (e) {
    console.error(e)
    dispatch(setScrapers(RemoteDataState.Error))
  }
}
开发者ID:sebito91,项目名称:influxdb,代码行数:19,代码来源:index.ts

示例8: async

export const getDashboardsAsync = () => async (
  dispatch: Dispatch<Action>,
  getState: GetState
): Promise<Dashboard[]> => {
  try {
    const {
      orgs: {org},
    } = getState()

    dispatch(setDashboards(RemoteDataState.Loading))
    const dashboards = await getDashboardsAJAX(org.id)
    dispatch(setDashboards(RemoteDataState.Done, dashboards))

    return dashboards
  } catch (error) {
    dispatch(setDashboards(RemoteDataState.Error))
    console.error(error)
    throw error
  }
}
开发者ID:sebito91,项目名称:influxdb,代码行数:20,代码来源:index.ts


注:本文中的src/types.GetState.default方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。