|
5 | 5 | <h1>{{ formatMessage(commonMessages.errorLabel) }}</h1> |
6 | 6 | </div> |
7 | 7 | <p> |
8 | | - <span>{{ error.data.error }}: </span> |
9 | | - {{ error.data.description }} |
| 8 | + <span>{{ error.data?.error }}: </span> |
| 9 | + {{ error.data?.description }} |
10 | 10 | </p> |
11 | 11 | </div> |
12 | | - <div v-else class="oauth-items"> |
| 12 | + <div v-else-if="app && createdBy && authorizationData" class="oauth-items"> |
13 | 13 | <div class="connected-items"> |
14 | 14 | <div class="profile-pics"> |
15 | 15 | <Avatar size="md" :src="app.icon_url" /> |
@@ -164,24 +164,31 @@ const { |
164 | 164 | data: authorizationData, |
165 | 165 | isPending: pending, |
166 | 166 | error, |
| 167 | + suspense: authSusp, |
167 | 168 | } = useQuery({ |
168 | 169 | queryKey: computed(() => ['authorization', clientId, redirectUri, scope, state]), |
169 | 170 | queryFn: getFlowIdAuthorization, |
170 | 171 | enabled: computed(() => !!clientId && !!redirectUri && !!scope), |
171 | 172 | }) |
172 | 173 |
|
173 | | -const { data: app } = useQuery({ |
| 174 | +const { data: app, suspense: appSusp } = useQuery({ |
174 | 175 | queryKey: computed(() => ['oauth/app', clientId]), |
175 | 176 | queryFn: () => client.labrinth.oauth_internal.getApp(clientId), |
176 | 177 | enabled: computed(() => !!clientId), |
177 | 178 | }) |
178 | 179 |
|
179 | | -const { data: createdBy } = useQuery({ |
| 180 | +const { data: createdBy, suspense: userSusp } = useQuery({ |
180 | 181 | queryKey: computed(() => ['user', app.value?.created_by]), |
181 | 182 | queryFn: () => client.labrinth.users_v2.get(app.value.created_by), |
182 | 183 | enabled: computed(() => !!app.value?.created_by), |
183 | 184 | }) |
184 | 185 |
|
| 186 | +onServerPrefetch(async () => { |
| 187 | + await authSusp() |
| 188 | + await appSusp() |
| 189 | + await userSusp() |
| 190 | +}) |
| 191 | +
|
185 | 192 | const scopeDefinitions = computed(() => |
186 | 193 | scopesToDefinitions(BigInt(authorizationData.value?.requested_scopes || 0)), |
187 | 194 | ) |
|
0 commit comments