當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。