cleanup TS type imports, remove programmatic version info
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import axios from "axios";
|
||||
import { MeganJohns } from "./types/MeganJohns";
|
||||
import { Artwork } from "./types/Artwork";
|
||||
import { Quote } from "./types/Quote";
|
||||
import { Video } from "./types/Video";
|
||||
import { Album } from "./types/Album";
|
||||
import { Bio, ProfessionalService } from "./types/Bio";
|
||||
import type { MeganJohns } from "./types/MeganJohns";
|
||||
import type { Artwork } from "./types/Artwork";
|
||||
import type { Quote } from "./types/Quote";
|
||||
import type { Video } from "./types/Video";
|
||||
import type { Album } from "./types/Album";
|
||||
import type { Bio, ProfessionalService } from "./types/Bio";
|
||||
|
||||
const baseURL = import.meta.env.VITE_API_URL as string;
|
||||
|
||||
@@ -19,7 +19,6 @@ export const getMeganJohns = async (): Promise<MeganJohns> => {
|
||||
const bio = response.data.bio as Bio;
|
||||
const professional_services = response.data
|
||||
.professional_services as ProfessionalService[];
|
||||
const version = response.data.version as string;
|
||||
return {
|
||||
artwork,
|
||||
videos,
|
||||
@@ -27,6 +26,5 @@ export const getMeganJohns = async (): Promise<MeganJohns> => {
|
||||
quotes,
|
||||
bio,
|
||||
professional_services,
|
||||
version,
|
||||
} as MeganJohns;
|
||||
};
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { getMeganJohns } from "./Api";
|
||||
import { MeganJohns } from "./types/MeganJohns";
|
||||
import { Album } from "./types/Album";
|
||||
import { Artwork } from "./types/Artwork";
|
||||
import { Quote } from "./types/Quote";
|
||||
import { Video } from "./types/Video";
|
||||
import { Bio, ProfessionalService } from "./types/Bio";
|
||||
import type { MeganJohns } from "./types/MeganJohns";
|
||||
import type { Album } from "./types/Album";
|
||||
import type { Artwork } from "./types/Artwork";
|
||||
import type { Quote } from "./types/Quote";
|
||||
import type { Video } from "./types/Video";
|
||||
import type { Bio, ProfessionalService } from "./types/Bio";
|
||||
import MjSection from "./MjSection";
|
||||
import Header from "./Header/Header";
|
||||
import About from "./About/Homepage";
|
||||
@@ -29,7 +29,7 @@ function App() {
|
||||
},
|
||||
(error) => {
|
||||
console.error(error);
|
||||
},
|
||||
}
|
||||
);
|
||||
}, []);
|
||||
|
||||
@@ -56,7 +56,6 @@ function App() {
|
||||
<MjSection sectionTitle="artwork" works={artwork} />
|
||||
<Videos videos={videos} />
|
||||
<About bio={bio} quotes={quotes} services={services} />
|
||||
<p>{mj.version}</p>
|
||||
</Container>
|
||||
</Container>
|
||||
);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Album } from "./Album";
|
||||
import { Artwork } from "./Artwork";
|
||||
import { Bio, ProfessionalService } from "./Bio";
|
||||
import { Quote } from "./Quote";
|
||||
import { Video } from "./Video";
|
||||
import type { Album } from "./Album";
|
||||
import type { Artwork } from "./Artwork";
|
||||
import type { Bio, ProfessionalService } from "./Bio";
|
||||
import type { Quote } from "./Quote";
|
||||
import type { Video } from "./Video";
|
||||
|
||||
export interface MeganJohns {
|
||||
artwork: Artwork[];
|
||||
@@ -11,5 +11,4 @@ export interface MeganJohns {
|
||||
quotes: Quote[];
|
||||
bio: Bio;
|
||||
professional_services: ProfessionalService[];
|
||||
version: string;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,6 @@ class Controller:
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
async def get_version(self) -> str:
|
||||
repo = Repo(Path.cwd().parent.joinpath(".git"))
|
||||
tags = [tag.tag for tag in repo.tags if tag.tag is not None]
|
||||
tags.sort(key=lambda t: t.tagged_date)
|
||||
return tags[-1].tag
|
||||
|
||||
async def get_all_videos(self) -> list[Video]:
|
||||
return Video.select_all()
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ class MeganJohns(BaseModel):
|
||||
videos: list[Video]
|
||||
bio: Bio
|
||||
professional_services: list[ProfessionalService]
|
||||
version: str
|
||||
|
||||
|
||||
@app.get("/")
|
||||
@@ -63,10 +62,4 @@ async def root() -> MeganJohns:
|
||||
videos=videos,
|
||||
bio=bio,
|
||||
professional_services=services,
|
||||
version=await controller.get_version(),
|
||||
)
|
||||
|
||||
|
||||
@app.get("/version")
|
||||
async def version() -> str:
|
||||
return await controller.get_version()
|
||||
|
||||
Reference in New Issue
Block a user