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

fix: Developer menu apps refresh bug #488

Merged
merged 2 commits into from
Oct 12, 2018

Conversation

whDongRui
Copy link
Contributor

@whDongRui whDongRui commented Oct 11, 2018

  • fix: Categories query and create btn bug

  • fix: Add role desc, app version desc bug

  • fix: Judge API transfer token bug

* fix: Categories query and create btn bug

* fix: Add role desc, app version desc bug
@whDongRui whDongRui requested a review from sunnywx October 11, 2018 16:35
@codecov
Copy link

codecov bot commented Oct 11, 2018

Codecov Report

Merging #488 into master will decrease coverage by 0.03%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #488      +/-   ##
==========================================
- Coverage   17.62%   17.58%   -0.04%     
==========================================
  Files          90       90              
  Lines        1396     1399       +3     
  Branches      290      293       +3     
==========================================
  Hits          246      246              
- Misses       1094     1097       +3     
  Partials       56       56
Impacted Files Coverage Δ
src/utils/index.js 1% <0%> (ø) ⬆️
src/components/Toolbar/index.jsx 0% <0%> (ø) ⬆️
src/components/Layout/SideNav/index.jsx 0% <0%> (ø) ⬆️
src/components/AppList/index.jsx 62.5% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9bf5dc3...1fc5b9f. Read the comment docs.

@@ -92,6 +80,11 @@ router.post('/api/*', async ctx => {
Object.assign(chooseToken, res);
}

// todo: redirect is no effect
if (!chooseToken.access_token) {
ctx.redirect('/login?url=' + endUrl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctx.redirect will redirect current request, meaning /api/apps => /api/login. You can use ctx.throw(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, change to: ctx.throw(401, 'Unauthorized: invalid access token'); but still not implement page redirection when not found token.

const { isLoading } = appStore;
const lng = i18n.language || 'zh';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to pass lng params, getPastTime can read it from localStorage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

const now = new Date();
const date = new Date(time);
const diff = (now.getTime() - date.getTime()) / (60 * 60 * 1000);
return diff / 24 > 1 ? parseInt(diff / 24) + ' days ago' : parseInt(diff) + ' hours ago';
let daysago = ' 天前',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think put locale string in this function is not good. What if there are other locales ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, add a translation.js for js file word translation.

@whDongRui whDongRui merged commit 575891c into openpitrix:master Oct 12, 2018
@sunnywx sunnywx mentioned this pull request Oct 12, 2018
@whDongRui whDongRui deleted the fix/menu-apps branch January 17, 2019 06:49
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.

2 participants