feat: add getLastModifiedDate

pull/26460/head^2
Nicolás Quiroz 2 years ago
parent d07464b8b0
commit 01c6252754
  1. 11
      src/utils/getLastModifiedDate.ts
  2. 1
      src/utils/index.ts

@ -0,0 +1,11 @@
import { LAST_COMMIT_BASE_URL } from '../constants';
export const getLastModifiedDate = async (filePath: string) =>
fetch(`${LAST_COMMIT_BASE_URL}${filePath}/index.md&page=1&per_page=1`)
.then(res => res.json())
.then(commits => commits[0].commit.committer.date)
.catch(_ =>
fetch(`${LAST_COMMIT_BASE_URL}${filePath}.md&page=1&per_page=1`)
.then(res => res.json())
.then(commits => commits[0].commit.committer.date)
);

@ -4,6 +4,7 @@ export { fetchLatestReleaseVersionAndName } from './fetchLatestReleaseVersionAnd
export { fetchXMLData } from './fetchXMLData'; export { fetchXMLData } from './fetchXMLData';
export { getChecksum } from './getChecksum'; export { getChecksum } from './getChecksum';
export { getKebabCaseFromName } from './getKebabCaseFromName'; export { getKebabCaseFromName } from './getKebabCaseFromName';
export { getLastModifiedDate } from './getLastModifiedDate';
export { getLatestBinaryURL } from './getLatestBinaryURL'; export { getLatestBinaryURL } from './getLatestBinaryURL';
export { getOS } from './getOS'; export { getOS } from './getOS';
export { getParsedDate } from './getParsedDate'; export { getParsedDate } from './getParsedDate';

Loading…
Cancel
Save