31 lines
665 B
TypeScript
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) })
|
|
}
|