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",
|
"package": "mk.mojmajstor.app",
|
||||||
"softwareKeyboardLayoutMode": "resize",
|
"softwareKeyboardLayoutMode": "resize",
|
||||||
"intentFilters": [
|
"intentFilters": [
|
||||||
{
|
|
||||||
"action": "VIEW",
|
|
||||||
"data": [
|
|
||||||
{
|
|
||||||
"scheme": "mojmajstor"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"category": [
|
|
||||||
"BROWSABLE",
|
|
||||||
"DEFAULT"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"action": "VIEW",
|
"action": "VIEW",
|
||||||
"data": [
|
"data": [
|
||||||
|
|||||||
@ -6,7 +6,22 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
|
|||||||
import { ThemeProvider, useTheme } from "../components/theme";
|
import { ThemeProvider, useTheme } from "../components/theme";
|
||||||
import { ToastProvider } from "../components/ui/toast";
|
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 = {
|
type AuthState = {
|
||||||
token: string | null;
|
token: string | null;
|
||||||
@ -140,6 +155,14 @@ export default function RootLayout() {
|
|||||||
|
|
||||||
if (!loaded) return null;
|
if (!loaded) return null;
|
||||||
|
|
||||||
|
if (!convex) {
|
||||||
|
return (
|
||||||
|
<ThemeProvider>
|
||||||
|
<MissingConfigScreen />
|
||||||
|
</ThemeProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConvexProvider client={convex}>
|
<ConvexProvider client={convex}>
|
||||||
<ThemeProvider>
|
<ThemeProvider>
|
||||||
@ -156,3 +179,18 @@ export default function RootLayout() {
|
|||||||
</ConvexProvider>
|
</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,
|
"developmentClient": true,
|
||||||
"distribution": "internal",
|
"distribution": "internal",
|
||||||
"channel": "development",
|
"channel": "development",
|
||||||
|
"env": {
|
||||||
|
"EXPO_PUBLIC_CONVEX_URL": "https://decisive-owl-34.eu-west-1.convex.cloud"
|
||||||
|
},
|
||||||
"android": {
|
"android": {
|
||||||
"buildType": "apk"
|
"buildType": "apk"
|
||||||
},
|
},
|
||||||
@ -18,13 +21,19 @@
|
|||||||
"preview": {
|
"preview": {
|
||||||
"distribution": "internal",
|
"distribution": "internal",
|
||||||
"channel": "preview",
|
"channel": "preview",
|
||||||
|
"env": {
|
||||||
|
"EXPO_PUBLIC_CONVEX_URL": "https://decisive-owl-34.eu-west-1.convex.cloud"
|
||||||
|
},
|
||||||
"android": {
|
"android": {
|
||||||
"buildType": "apk"
|
"buildType": "apk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"production": {
|
"production": {
|
||||||
"channel": "production",
|
"channel": "production",
|
||||||
"autoIncrement": true
|
"autoIncrement": true,
|
||||||
|
"env": {
|
||||||
|
"EXPO_PUBLIC_CONVEX_URL": "https://decisive-owl-34.eu-west-1.convex.cloud"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"submit": {
|
"submit": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user