Skip to content

Commit

Permalink
Provide working defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
NSeydoux committed Sep 10, 2024
1 parent 52c40dc commit 881e848
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/login/LoginWebViewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
Modal,
} from "react-native";
import { WebView, type WebViewNavigation } from "react-native-webview";
import { DEFAULT_LOGIN_URL, DEFAULT_WALLET_API } from "@/constants/defaults";

interface LoginWebViewModalProps {
onClose: () => void;
Expand All @@ -36,8 +37,8 @@ const LoginWebViewModal: React.FC<LoginWebViewModalProps> = ({
onLogoutSuccess = () => null,
requestMode = "blank",
}) => {
const BASE_URL = process.env.EXPO_PUBLIC_WALLET_API || "";
const LOGIN_URL = process.env.EXPO_PUBLIC_LOGIN_URL || "";
const BASE_URL = process.env.EXPO_PUBLIC_WALLET_API ?? DEFAULT_LOGIN_URL;
const LOGIN_URL = process.env.EXPO_PUBLIC_LOGIN_URL ?? DEFAULT_WALLET_API;
const LOGOUT_URL = `${BASE_URL}/logout`;

const webViewRef = useRef<WebView | null>(null);
Expand Down
19 changes: 19 additions & 0 deletions constants/defaults.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// Copyright Inrupt Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

export const DEFAULT_LOGIN_URL =
"https://datawallet.inrupt.com/oauth2/authorization/wallet-app";
export const DEFAULT_WALLET_API = "https://datawallet.inrupt.com";

0 comments on commit 881e848

Please sign in to comment.