fix data type

ldap-exec-test
Rebecca-Chou 9 months ago
parent ccd075fa84
commit 00caa70143
  1. 14
      lib/team.ts
  2. 2
      pages/about/team.tsx

@ -88,13 +88,11 @@ export async function getExecNamePosPairs() {
return formattedExec;
}
export async function getExec(execNamePosPair: string[], convert = true) {
export async function getExec(name: string, pos: string, convert = true) {
let content, metadata;
try {
const raw = await readFile(
path.join(EXECS_PATH, `${execNamePosPair[0]}${fileType}`)
);
const raw = await readFile(path.join(EXECS_PATH, `${name}${fileType}`));
({ content, data: metadata } = matter(raw));
const image =
@ -107,13 +105,11 @@ export async function getExec(execNamePosPair: string[], convert = true) {
};
} catch (err) {
const firstName =
execNamePosPair[0].split("-")[0][0].toUpperCase() +
execNamePosPair[0].split("-")[0].slice(1);
name.split("-")[0][0].toUpperCase() + name.split("-")[0].slice(1);
const lastName =
execNamePosPair[0].split("-")[1][0].toUpperCase() +
execNamePosPair[0].split("-")[1].slice(1);
name.split("-")[1][0].toUpperCase() + name.split("-")[1].slice(1);
const posName = execPositions[execNamePosPair[1]];
const posName = execPositions[pos];
({ content, metadata } = {
content: "Coming soon!",
metadata: {

@ -211,7 +211,7 @@ export const getStaticProps: GetStaticProps<Props> = async () => {
const execNamePosPairs = await getExecNamePosPairs();
const execs = (await Promise.all(
execNamePosPairs.map((namePosPair) => getExec(namePosPair))
execNamePosPairs.map((posPairs) => getExec(posPairs[0], posPairs[1]))
)) as SerializedExec[];
const [

Loading…
Cancel
Save