You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
978 B
46 lines
978 B
import { fetch } from './fetch'
|
|
|
|
interface AvailabilityResponse {
|
|
id: string
|
|
available: boolean
|
|
}
|
|
|
|
interface RegisterResponse {
|
|
id: string
|
|
access: string
|
|
refresh: string
|
|
}
|
|
|
|
export async function fetchGroupAvailability(name: string) {
|
|
return await fetch<AvailabilityResponse>({
|
|
path: '/api/group/available',
|
|
method: 'post',
|
|
body: {
|
|
name,
|
|
},
|
|
})
|
|
}
|
|
|
|
export async function fetchUserAvailability(name: string) {
|
|
return await fetch<AvailabilityResponse>({
|
|
path: '/api/user/available',
|
|
method: 'post',
|
|
body: {
|
|
name,
|
|
},
|
|
})
|
|
}
|
|
|
|
export async function register(id: string, email: string, password: string, name?: string, group?: string) {
|
|
return await fetch<RegisterResponse>({
|
|
path: '/api/register',
|
|
method: 'post',
|
|
body: {
|
|
id,
|
|
email,
|
|
password,
|
|
name,
|
|
group,
|
|
},
|
|
})
|
|
}
|