Skip to content

Commit 1504940

Browse files
authored
Hotfix uncaught error from failed fetch (#123)
1 parent 09fddfb commit 1504940

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/sagas/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,10 @@ function* loginSaga(): SagaIterator {
7878
})
7979

8080
yield takeEvery(actionTypes.FETCH_USERNAME, function*() {
81-
const apiUsername = 'https://ivle.nus.edu.sg/api/Lapi.svc/UserName_Get'
82-
const key = IVLE_KEY
83-
const token = yield select((state: IState) => state.session.token)
84-
const username = yield call(() =>
85-
fetch(`${apiUsername}?APIKey=${key}&Token=${token}`).then(response => response.json())
86-
)
81+
// TODO: use an API call to the backend; an api call to IVLE raises an
82+
// uncaught error due to restrictive Access-Control-Allow-Origin headers,
83+
// causing the staging server to bug out
84+
const username = yield call(() => 'IVLE USER')
8785
yield put(actions.setUsername(username))
8886
})
8987
}

0 commit comments

Comments
 (0)