Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make configuring baseURL easier and make the errors friendly #9

Merged
merged 4 commits into from Oct 18, 2020

Conversation

pan93412
Copy link
Collaborator

@pan93412 pan93412 commented Oct 17, 2020

First, I separate the baseURL option from utils/request.js.

And, I replaced the ugly if-statement with Map, and I also make the message user-friendly since this project is written for users, not only for developers.

And also, I removed the useless "alert", it is useless and annoying for users.

pan93412 and others added 4 commits October 17, 2020 16:15
I replaced the ugly if-statement with Map, and
I also make the message user-friendly
since this project is written for users, not only for developers.

And also, I removed the useless "alert", it is useless and annoying for users.
@pan93412
Copy link
Collaborator Author

首先,我把 baseURLutils/request.js 分出來,這樣對使用者設定會比較友善。

此外,我把原本很醜的 if 表示式以 Map 改寫,同時我也讓訊息比較好懂,畢竟這個專案的目標客群是一般使用者,盡可能用些平易近人的錯誤訊息。

最後,我把一些沒必要的 alert 刪掉了,一般使用者看不懂。還是有留 console.log,開發者仍然可以在 DevTools 查看錯誤訊息。

@qier222
Copy link
Owner

qier222 commented Oct 17, 2020

不如用.env文件?另外我准备将来将baseUrl存储到local storage,让使用者可以在设置页面自定义api url
https://cli.vuejs.org/zh/guide/mode-and-env.html

@pan93412
Copy link
Collaborator Author

pan93412 commented Oct 17, 2020

不如用.env文件?另外我准备将来将baseUrl存储到local storage,让使用者可以在设置页面自定义api url
https://cli.vuejs.org/zh/guide/mode-and-env.html

好呀!此外 API 的主要目的是取得網易雲音樂的資料,而各個 API 之間幾乎沒有差異,所以我覺得 API URL 沒有必要讓使用者設定。如果程式的 API 網址掛了,那應該是維護者去修,不應該讓使用者自己修;如果覺得 API 的速度太慢,那我不覺得使用者能找到與之版本匹配,其他區域的 API。

@qier222
Copy link
Owner

qier222 commented Oct 17, 2020

可自定义api url是出于隐私的考虑, 部分人会觉得用自己的api比较安心

@pan93412
Copy link
Collaborator Author

可自定义api url是出于隐私的考虑, 部分人会觉得用自己的api比较安心

其實我覺得真正會在乎隱私的,會選擇自己架設服務。我是建議等到有人開 Issues,有需求時再開發。

@pan93412
Copy link
Collaborator Author

畢竟開發設定面板所花的時間,可能已經遠遠超過這功能所能帶來的效益。

@qier222
Copy link
Owner

qier222 commented Oct 17, 2020

设置页面还有其他的设置项,比如Light Mode/Dark Mode切换

@pan93412
Copy link
Collaborator Author

设置页面还有其他的设置项,比如Light Mode/Dark Mode切换

聽起來不錯!那我覺得開發這功能尚算值得,期待你未來的更新 :)

@pan93412
Copy link
Collaborator Author

@qier222 那你打算 merge 這個 PR 嗎?

@qier222 qier222 merged commit bce0935 into qier222:master Oct 18, 2020
@pan93412 pan93412 deleted the feature/request branch October 18, 2020 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants