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

Variable naming pattern #6

Closed
ace-han opened this issue Sep 11, 2021 · 0 comments
Closed

Variable naming pattern #6

ace-han opened this issue Sep 11, 2021 · 0 comments

Comments

@ace-han
Copy link
Owner

ace-han commented Sep 11, 2021

  • In graphene backend => UnderScoreCase
  • In any frontend => CamelCase

Take below for example

# for the time being,  should be data.get('refresh_token')
# refresh_token = data.get("refresh_token") or refresh_token
# this refresh_token_code comes from 
# saleor/graphql/account/mutations/authentication.py
class RefreshToken(BaseMutation):
     class Arguments:
         refresh_token = graphene.String(required=False, description="Refresh token.")
#  although in the frontend it's `refreshToken` graphene will transform to `refresh_token`
# saleor-dashboard/src/auth/hooks/useExternalAuthProvider.ts
const token = getTokens().refresh;
const input = JSON.stringify({
   refreshToken: token
});
return tokenRefresh({ variables: { input, pluginId: authPlugin } }).then(...)
ace-han added a commit that referenced this issue Sep 11, 2021
@ace-han ace-han closed this as completed Sep 11, 2021
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

No branches or pull requests

1 participant