fix expo public convex url
This commit is contained in:
parent
9e035d0f03
commit
6feaaeb24c
12
app.json
12
app.json
@ -21,18 +21,6 @@
|
||||
"package": "mk.mojmajstor.app",
|
||||
"softwareKeyboardLayoutMode": "resize",
|
||||
"intentFilters": [
|
||||
{
|
||||
"action": "VIEW",
|
||||
"data": [
|
||||
{
|
||||
"scheme": "mojmajstor"
|
||||
}
|
||||
],
|
||||
"category": [
|
||||
"BROWSABLE",
|
||||
"DEFAULT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"action": "VIEW",
|
||||
"data": [
|
||||
|
||||
@ -6,7 +6,22 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import { ThemeProvider, useTheme } from "../components/theme";
|
||||
import { ToastProvider } from "../components/ui/toast";
|
||||
|
||||
const convex = new ConvexReactClient(process.env.EXPO_PUBLIC_CONVEX_URL!);
|
||||
const CONVEX_URL = process.env.EXPO_PUBLIC_CONVEX_URL;
|
||||
|
||||
function getConvexClient(): ConvexReactClient | null {
|
||||
if (!CONVEX_URL) {
|
||||
console.error("Missing EXPO_PUBLIC_CONVEX_URL environment variable");
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return new ConvexReactClient(CONVEX_URL);
|
||||
} catch (e) {
|
||||
console.error("Failed to create Convex client:", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const convex = getConvexClient();
|
||||
|
||||
type AuthState = {
|
||||
token: string | null;
|
||||
@ -140,6 +155,14 @@ export default function RootLayout() {
|
||||
|
||||
if (!loaded) return null;
|
||||
|
||||
if (!convex) {
|
||||
return (
|
||||
<ThemeProvider>
|
||||
<MissingConfigScreen />
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<ConvexProvider client={convex}>
|
||||
<ThemeProvider>
|
||||
@ -156,3 +179,18 @@ export default function RootLayout() {
|
||||
</ConvexProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function MissingConfigScreen() {
|
||||
const theme = useTheme();
|
||||
return (
|
||||
<View style={{ flex: 1, justifyContent: "center", alignItems: "center", padding: 24, backgroundColor: theme.colors.background }}>
|
||||
<Text style={{ fontSize: 48, marginBottom: 16 }}>⚙️</Text>
|
||||
<Text style={{ ...theme.typography.h2, color: theme.colors.text, marginBottom: 8, textAlign: "center" }}>
|
||||
Конфигурациска грешка
|
||||
</Text>
|
||||
<Text style={{ ...theme.typography.body, color: theme.colors.textSecondary, textAlign: "center", marginBottom: 24 }}>
|
||||
Недостасува EXPO_PUBLIC_CONVEX_URL. Проверете ја конфигурацијата за изградба.
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
11
eas.json
11
eas.json
@ -8,6 +8,9 @@
|
||||
"developmentClient": true,
|
||||
"distribution": "internal",
|
||||
"channel": "development",
|
||||
"env": {
|
||||
"EXPO_PUBLIC_CONVEX_URL": "https://decisive-owl-34.eu-west-1.convex.cloud"
|
||||
},
|
||||
"android": {
|
||||
"buildType": "apk"
|
||||
},
|
||||
@ -18,13 +21,19 @@
|
||||
"preview": {
|
||||
"distribution": "internal",
|
||||
"channel": "preview",
|
||||
"env": {
|
||||
"EXPO_PUBLIC_CONVEX_URL": "https://decisive-owl-34.eu-west-1.convex.cloud"
|
||||
},
|
||||
"android": {
|
||||
"buildType": "apk"
|
||||
}
|
||||
},
|
||||
"production": {
|
||||
"channel": "production",
|
||||
"autoIncrement": true
|
||||
"autoIncrement": true,
|
||||
"env": {
|
||||
"EXPO_PUBLIC_CONVEX_URL": "https://decisive-owl-34.eu-west-1.convex.cloud"
|
||||
}
|
||||
}
|
||||
},
|
||||
"submit": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user