Skip to content
Snippets Groups Projects
Commit adc7a909 authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Valentin Rigal
Browse files

Entypescripten the OAuth API helpers

parent 0a9a5e56
No related branches found
No related tags found
1 merge request!1521Entypescripten the OAuth API helpers
import axios from 'axios'
import { unique } from '.'
// List OAuth providers (GitLab, etc.)
export const listProviders = unique(async () => (await axios.get('/oauth/providers/')).data)
// List OAuth credentials (known accounts)
export const listCredentials = unique(async params => (await axios.get('/oauth/credentials/', { params })).data)
// Delete a registered OAuth account
export const deleteCredentials = unique(id => axios.delete(`/oauth/credentials/${id}/`))
import axios from 'axios'
import { UUID, PageNumberPagination } from '@/types'
import { OAuthCredentials, OAuthProvider } from '@/types/oauth'
import { unique, PageNumberPaginationParameters } from '.'
/**
* List OAuth providers (GitLab, etc.).
*/
export const listProviders = unique(async (): Promise<OAuthProvider[]> => (await axios.get('/oauth/providers/')).data)
/**
* List OAuth credentials (known accounts).
*/
export const listCredentials = unique(async (params: PageNumberPaginationParameters): Promise<PageNumberPagination<OAuthCredentials>> => (await axios.get('/oauth/credentials/', { params })).data)
/**
* Delete a registered OAuth account.
*/
export const deleteCredentials = unique((id: UUID) => axios.delete(`/oauth/credentials/${id}/`))
import { UUID } from '.'
export interface OAuthProvider {
name: string
display_name: string
default_url: string
}
export type OAuthStatus = 'created' | 'done' | 'error'
export interface OAuthCredentials {
id: UUID
status: OAuthStatus
provider_name: string
provider_display_name: string
provider_url: string
account_name: string | null
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment