-
Notifications
You must be signed in to change notification settings - Fork 293
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(vue): remove mock facade values code #4061
Changes from all commits
a442a9b
dfd3249
67e95f3
899aa72
6e7b4d0
2972567
302a74f
ffa3957
79fbbf3
8a7f1a9
bdeaf82
3e7f360
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ import { | |
} from '@aws-amplify/ui'; | ||
|
||
import { UseAuth } from '../types'; | ||
import { facade } from './useUtils'; | ||
|
||
export const useAuth = createSharedComposable((): UseAuth => { | ||
const machine = createAuthenticatorMachine(); | ||
|
@@ -53,20 +52,25 @@ export const useAuth = createSharedComposable((): UseAuth => { | |
export const useAuthenticator = createSharedComposable(() => { | ||
const { authStatus, state, send } = useAuth(); | ||
|
||
const useAuthenticatorValue = reactive({ | ||
...facade, | ||
send, | ||
state, | ||
}) as any; | ||
// TODO(BREAKING): remove the cast to any | ||
const useAuthenticatorValue = reactive({}) as any; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This initial value is not needed, because I actually prefer this because now we only have one place where we populate |
||
|
||
/* | ||
* Note that watchEffect runs immediately, so `useAuthenticatorValue` is | ||
* guaranteed to have facade values by the time `useAuthenticator` returns. | ||
* | ||
* https://vuejs.org/api/reactivity-core.html#watcheffect | ||
*/ | ||
watchEffect(() => { | ||
const facadeValues = getServiceFacade({ | ||
send, | ||
state: state.value, | ||
}); | ||
const facade = getServiceFacade({ send, state: state.value }); | ||
|
||
/* | ||
* TODO(BREAKING): consider using a plain object with `refs` instead of | ||
* one `reactive` object to prevent iterating manually over its keys. | ||
*/ | ||
for (const key of Object.keys(facade)) { | ||
//@ts-ignore | ||
useAuthenticatorValue[key] = facadeValues[key]; | ||
useAuthenticatorValue[key] = facade[key]; | ||
} | ||
useAuthenticatorValue.authStatus = authStatus.value; | ||
useAuthenticatorValue.send = send; | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this because
socialProviders
was previously broken.