import { Redirect, RedirectInfo } from '../types/api'; import { handleFetch } from './helpers'; export default class RedirectApi { public static async getRedirects(pageId: string): Promise { const response = await handleFetch(`/redirect/to/${pageId}`); return response.json(); } public static async getRedirectInfo(redirectId: string): Promise { const response = await handleFetch(`/redirect/info/${redirectId}`); return response.json(); } public static async getAbsoluteUrlForOriginPath(path: string): Promise { const response = await handleFetch(`/redirect/relativeurl`, { method: 'post', body: JSON.stringify(path) }); return response.json(); } }