w-aura/src/api/resources/UserDailyForecasts.ts
Aidar Shaikhutdin @makeweb.space 3e9cb7f233 feat: add api provider
2023-05-10 16:01:41 +06:00

31 lines
665 B
TypeScript

import routes from "../../routes"
import { AuthToken } from "../types"
import { getAuthHeaders } from "../utils"
export interface Payload {
token: AuthToken
}
export interface Response {
user_daily_forecast: UserDailyForecast
}
export interface UserDailyForecast {
day: string
updated_at: string
viewed_at: string | null
sign_id: number
forecasts: Forecast[]
}
export interface Forecast {
category_name: string
category: string
body: string
}
export const createRequest = ({ token }: Payload): Request => {
const url = new URL(routes.server.dailyForecasts())
return new Request(url, { method: 'GET', headers: getAuthHeaders(token) })
}