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: Update Auth to import JS using named export #10033

Merged
merged 4 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/auth/src/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
StorageHelper,
ICredentials,
Parser,
JS,
browserOrNode,
UniversalStorage,
urlSafeDecode,
} from '@aws-amplify/core';
Expand Down Expand Up @@ -1905,7 +1905,7 @@ export class AuthClass {
resolve: () => void,
reject: (reason?: any) => void
) {
const { isBrowser } = JS.browserOrNode();
const { isBrowser } = browserOrNode();

if (isBrowser) {
this.oAuthSignOutRedirectOrReject(reject);
Expand Down Expand Up @@ -2273,7 +2273,7 @@ export class AuthClass {
);

const currentUrl =
URL || (JS.browserOrNode().isBrowser ? window.location.href : '');
URL || (browserOrNode().isBrowser ? window.location.href : '');

const hasCodeOrError = !!(parse(currentUrl).query || '')
.split('&')
Expand Down
6 changes: 3 additions & 3 deletions packages/auth/src/urlListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
import { JS } from '@aws-amplify/core';
import { browserOrNode } from '@aws-amplify/core';

export default callback => {
if (JS.browserOrNode().isBrowser && window.location) {
if (browserOrNode().isBrowser && window.location) {
const url = window.location.href;

callback({ url });
} else if (JS.browserOrNode().isNode) {
} else if (browserOrNode().isNode) {
// continue building on ssr
() => {}; // noop
} else {
Expand Down