Skip to content

Commit

Permalink
feat(core): ✨ store target in the cache based on server response
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierfoucrier committed May 17, 2023
1 parent 1d187de commit f321926
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/core/src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function request(
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
cache.update(url, { status: 'fulfilled' });
resolve({
url: {
href: xhr.responseURL,
Expand All @@ -45,6 +44,10 @@ function request(
html: xhr.responseText
});

cache.update(url, {
status: 'fulfilled',
target: xhr.responseURL
});
} else if (xhr.status) {
// HTTP code is not 200, reject with response.
const response = {
Expand Down

0 comments on commit f321926

Please sign in to comment.