Skip to content

Commit

Permalink
chore: use native fetch for simple request
Browse files Browse the repository at this point in the history
 - fetch is this baseline now so it's safe to use in a browser
  • Loading branch information
yanfali committed Oct 23, 2024
1 parent a922ca4 commit bc5ae10
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/store/status.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { defineStore } from 'pinia';
import axios from 'axios';
import { backend_readme_url_template } from './modules/constants';
import { escape } from 'lodash';

Expand Down Expand Up @@ -49,15 +48,16 @@ export const useStatusStore = defineStore('status', {
* @returns Promise<Axios>
*/
async viewReadme(keyboard) {
return axios
.get(backend_readme_url_template({ keyboard: keyboard }))
.then((result) => {
if (result.status === 200) {
this.message = `${escape(result.data)}${this.deferredMessage}`;
return fetch(backend_readme_url_template({ keyboard: keyboard })).then(
async (response) => {
if (response.ok) {
const description = await response.text();
this.message = `${escape(description)}${this.deferredMessage}`;
this.deferredMessage = '';
this.scrollToEnd();
}
});
}
);
}
}
});

0 comments on commit bc5ae10

Please sign in to comment.