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

Create Auth API #4

Merged
merged 28 commits into from
Jul 14, 2020
Merged

Create Auth API #4

merged 28 commits into from
Jul 14, 2020

Conversation

orzechdev
Copy link
Contributor

@orzechdev orzechdev commented May 29, 2020

It moves main auth functionality entirely to sdk.
It adds the following useAuth() hook to the SDK:

const {
  loaded,
  authenticated,
  token,
  user,
  signIn,
  signOut,
} = useAuth();

@orzechdev orzechdev force-pushed the refactor/user-auth branch 11 times, most recently from a1bbc60 to d201935 Compare June 5, 2020 09:30
src/api/Auth/index.ts Outdated Show resolved Hide resolved
src/react/components/SaleorProvider/types.ts Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@@ -1,29 +1,81 @@
import React, { useMemo, useState } from "react";
import React, { useEffect, useMemo, useState } from "react";
import { persistCache } from "apollo-cache-persist";

Choose a reason for hiding this comment

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

I don't think that we want to pin sdk user to persisted cache

Copy link
Contributor Author

@orzechdev orzechdev Jul 9, 2020

Choose a reason for hiding this comment

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

Ok, I have added to the createSaleorCache() function the code, which persists cache in local storage only if parameter persistCache is set to true. Also, check out updated readme.md file for a better explanation. Is it the right solution now?

src/react/components/SaleorProvider/SaleorProvider.tsx Outdated Show resolved Hide resolved
src/react/components/SaleorProvider/types.ts Outdated Show resolved Hide resolved
src/react/useHook.ts Outdated Show resolved Hide resolved
src/api/Auth/types.ts Outdated Show resolved Hide resolved
src/api/index.ts Outdated Show resolved Hide resolved
src/react/components/SaleorProvider/SaleorProvider.tsx Outdated Show resolved Hide resolved
@orzechdev orzechdev force-pushed the refactor/user-auth branch 3 times, most recently from d2ecb4f to 9cf1a30 Compare July 9, 2020 12:37
@orzechdev orzechdev requested a review from AlicjaSzu July 14, 2020 12:11
@dominik-zeglen dominik-zeglen merged commit a3c0a1f into master Jul 14, 2020
@dominik-zeglen dominik-zeglen deleted the refactor/user-auth branch July 14, 2020 12:32
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.

3 participants