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() }