-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified Dynamic Path for Model View
- Loading branch information
1 parent
659e670
commit c4a83d9
Showing
3 changed files
with
93 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { title } from "process"; | ||
import ModelView from "../../../../../../components/Models"; | ||
|
||
interface ParamsType { | ||
slug: Array<string>; | ||
} | ||
|
||
interface Model { | ||
area: string; | ||
title: string; | ||
} | ||
|
||
import axios from "axios"; | ||
|
||
export async function generateStaticParams() { | ||
const response = await axios.get( | ||
"https://admin.models.ai4bharat.org/models/" | ||
); | ||
const models = response.data; | ||
|
||
let params: any[] = []; | ||
|
||
models.forEach((model: Model) => { | ||
params.push({ | ||
area: model.area, | ||
title: model.title, | ||
}); | ||
}); | ||
|
||
return params; | ||
} | ||
|
||
export const dynamicParams = true; | ||
export default function Model({ | ||
params, | ||
}: { | ||
params: { area: string; title: string }; | ||
}) { | ||
return ( | ||
<> | ||
<ModelView area={params.area} title={params.title} /> | ||
</> | ||
); | ||
} |