-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from visiky/fix-pr-54
fix: 修复首次进入,没有请求简历信息
- Loading branch information
Showing
3 changed files
with
60 additions
and
41 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 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,22 @@ | ||
import fetch from 'cross-fetch'; | ||
import _ from "lodash"; | ||
import { ResumeConfig } from "@/components/types"; | ||
import { customAssign } from "./customAssign"; | ||
|
||
export function fetchResume(lang: string, branch: string, user: string): Promise<ResumeConfig> { | ||
|
||
return fetch( | ||
`https://raw.githubusercontent.com/${user}/${user}/${branch}/resume.json` | ||
) | ||
.then(data => { | ||
if (data.status !== 200) { | ||
return Promise.reject(new Error()); | ||
} | ||
return data.json(); | ||
}) | ||
.then(data => { | ||
return _.omit(customAssign({}, data, _.get(data, ['locales', lang])), [ | ||
'locales', | ||
]) | ||
}); | ||
} |
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