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.
24 lines
551 B
24 lines
551 B
import { API_ROOT } from 'features/AuthServiceApp/config/routes'
|
|
|
|
export type FailedResponse = {
|
|
error?: string,
|
|
ok: false,
|
|
}
|
|
|
|
export type SuccessResponse = {
|
|
ok: true,
|
|
}
|
|
|
|
export const checkDevice = async (token: string) => {
|
|
const url = `${API_ROOT}/authorize/check-device?access_token=${token}`
|
|
|
|
const config = {
|
|
method: 'GET',
|
|
}
|
|
|
|
const response = await fetch(url, config)
|
|
|
|
const body: SuccessResponse | FailedResponse | undefined = await response.json()
|
|
|
|
return (body && !body.ok) ? Promise.reject(body) : Promise.resolve()
|
|
}
|
|
|