Compare commits

...
Author SHA1 Message Date
Brandon Thomas b664d21565 note 2025-09-18 14:47:53 -04:00
Brandon Thomas 830d618af1 error handle credits fetch 2025-09-18 14:36:24 -04:00
Brandon Thomas 855eb40786 Error handle getting subscription state 2025-09-18 14:34:50 -04:00
Brandon Thomas bcc553e7e5 clarity csp 2025-09-18 14:15:04 -04:00
5 changed files with 23 additions and 9 deletions
+2 -2
View File
@@ -46,10 +46,10 @@
"img-src": "* data: blob: 'unsafe-inline'",
"script-src": [
"'self'",
"https://*.clarity.ms",
"https://*.fakeyou.com",
"https://*.storyteller.ai",
"https://www.clarity.ms",
"https://scripts.clarity.ms",
"https://clarity.ms",
"ipc://localhost",
"tauri://localhost"
],
+2 -2
View File
@@ -46,10 +46,10 @@
"img-src": "* data: blob: 'unsafe-inline'",
"script-src": [
"'self'",
"https://*.clarity.ms",
"https://*.fakeyou.com",
"https://*.storyteller.ai",
"https://www.clarity.ms",
"https://scripts.clarity.ms",
"https://clarity.ms",
"ipc://localhost",
"tauri://localhost"
],
@@ -26,7 +26,13 @@ export const useCreditsState = create<CreditsState>()((set) => ({
// Call to fetch credits from the server
fetchFromServer: async () => {
const data = await ArtcraftGetCredits();
let data;
try {
data = await ArtcraftGetCredits();
} catch (error) {
console.error("Error fetching credits", error);
return;
}
if (!!data.payload) {
set((state) => ({
freeCredits: data.payload.free_credits,
@@ -36,4 +42,4 @@ export const useCreditsState = create<CreditsState>()((set) => ({
}));
}
}
}))
}))
@@ -52,10 +52,15 @@ export const useSubscriptionState = create<SubscriptionState>()((set, get) => ({
// Call to fetch credits from the server
fetchFromServer: async () => {
const data = await ArtcraftGetSubscription();
let data;
try {
data = await ArtcraftGetSubscription();
} catch (error) {
console.error("Error fetching subscription", error);
return;
}
if (!!data.payload) {
let activeSubscription = undefined;
console.log(">>> subscription data.payload", data.payload);
if (!!data.payload.active_subscription) {
activeSubscription = {
subscriptionToken: data.payload.active_subscription.subscription_token,
@@ -65,7 +70,6 @@ export const useSubscriptionState = create<SubscriptionState>()((set, get) => ({
subscriptionEndAt: data.payload.active_subscription.subscription_end_at ? new Date(data.payload.active_subscription.subscription_end_at) : undefined,
};
}
console.log(">>> activeSubscription", activeSubscription);
set((state) => ({
subscriptionInfo: activeSubscription,
}));
+4
View File
@@ -24,8 +24,12 @@ popd || exit
export TAURI_FRONTEND_PATH="${frontend_path}"
export TAURI_APP_PATH="${rust_crate_path}"
# NB: The "frontend dev" script sets "production" too, so this must only control the
# hostnames we use, not minification, etc.
export VITE_ENVIRONMENT_TYPE="production"
# This appears to trigger "nx build" instead of "nx dev".
cargo tauri build --config "${config_path}"
echo "Done!"