mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: handle 401
This commit is contained in:
parent
4a08a0ec92
commit
42dadbd8db
1 changed files with 1 additions and 2 deletions
|
|
@ -42,8 +42,7 @@ async function request(url: string, { accessToken }: Options = {}) {
|
|||
if (res.ok) {
|
||||
return res.json()
|
||||
} else {
|
||||
// for private repo, GitHub api also responses with 404 when unauthorized
|
||||
if (res.status === 404) throw new Error(NOT_FOUND)
|
||||
if (res.status === 404 || res.status === 401) throw new Error(NOT_FOUND)
|
||||
else if (res.status === 500) throw new Error(SERVER_FAULT)
|
||||
else {
|
||||
const content = await res.json()
|
||||
|
|
|
|||
Loading…
Reference in a new issue