From fdd9f37abd7513e6d0d548d5b2ad9e9cb6791e54 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 26 Aug 2022 11:30:45 -0700 Subject: [PATCH] Added error handling for layout.server.ts to avoid unaccessible to previous deploy instance due to changes in SvelteKit project --- mobile/ios/Runner.xcodeproj/project.pbxproj | 6 ++--- mobile/ios/Runner/Info.plist | 4 +-- mobile/ios/fastlane/report.xml | 12 ++++----- web/src/routes/+layout.server.ts | 29 ++++++++++++--------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/mobile/ios/Runner.xcodeproj/project.pbxproj b/mobile/ios/Runner.xcodeproj/project.pbxproj index e5399800c3..79fc55d29f 100644 --- a/mobile/ios/Runner.xcodeproj/project.pbxproj +++ b/mobile/ios/Runner.xcodeproj/project.pbxproj @@ -360,7 +360,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 40; + CURRENT_PROJECT_VERSION = 51; DEVELOPMENT_TEAM = 2F67MQ8R79; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -495,7 +495,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 40; + CURRENT_PROJECT_VERSION = 51; DEVELOPMENT_TEAM = 2F67MQ8R79; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -522,7 +522,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 40; + CURRENT_PROJECT_VERSION = 51; DEVELOPMENT_TEAM = 2F67MQ8R79; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; diff --git a/mobile/ios/Runner/Info.plist b/mobile/ios/Runner/Info.plist index e25281d68a..559678ad2a 100644 --- a/mobile/ios/Runner/Info.plist +++ b/mobile/ios/Runner/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.21.0 + 1.26.0 CFBundleSignature ???? CFBundleVersion - 40 + 51 LSRequiresIPhoneOS MGLMapboxMetricsEnabledSettingShownInApp diff --git a/mobile/ios/fastlane/report.xml b/mobile/ios/fastlane/report.xml index 8522da91c2..6c34cef00e 100644 --- a/mobile/ios/fastlane/report.xml +++ b/mobile/ios/fastlane/report.xml @@ -5,32 +5,32 @@ - + - + - + - + - + - + diff --git a/web/src/routes/+layout.server.ts b/web/src/routes/+layout.server.ts index 81f3e8879a..ad51683594 100644 --- a/web/src/routes/+layout.server.ts +++ b/web/src/routes/+layout.server.ts @@ -1,23 +1,26 @@ -import { browser } from '$app/env'; -import { api, serverApi } from '@api'; +import { serverApi } from '@api'; import * as cookieParser from 'cookie'; import type { LayoutServerLoad } from './$types'; export const load: LayoutServerLoad = async ({ request }) => { - const cookies = cookieParser.parse(request.headers.get('cookie') || ''); - const accessToken = cookies['immich_access_token']; + try { + const cookies = cookieParser.parse(request.headers.get('cookie') || ''); + const accessToken = cookies['immich_access_token']; + + if (!accessToken) { + return { + user: undefined + }; + } + + serverApi.setAccessToken(accessToken); + const { data: userInfo } = await serverApi.userApi.getMyUserInfo(); - if (!accessToken) { return { - user: undefined + user: userInfo }; + } catch (e) { + console.log('[ERROR] layout.server.ts [LayoutServerLoad]: ', e); } - - serverApi.setAccessToken(accessToken); - const { data: userInfo } = await serverApi.userApi.getMyUserInfo(); - - return { - user: userInfo - }; };