fix: GitLab loop on misconfigured source
This commit is contained in:
parent
8f9462245a
commit
9b47de71fc
@ -78,7 +78,7 @@ async function send({
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
if (response.status === 401 && !path.startsWith('https://api.github')) {
|
if (response.status === 401 && !path.startsWith('https://api.github') && !path.includes('/v4/user')) {
|
||||||
Cookies.remove('token');
|
Cookies.remove('token');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
branches: false,
|
branches: false,
|
||||||
save: false
|
save: false
|
||||||
};
|
};
|
||||||
|
let tryAgain = false;
|
||||||
|
|
||||||
let htmlUrl = application.gitSource.htmlUrl;
|
let htmlUrl = application.gitSource.htmlUrl;
|
||||||
let apiUrl = application.gitSource.apiUrl;
|
let apiUrl = application.gitSource.apiUrl;
|
||||||
@ -55,10 +56,11 @@
|
|||||||
Authorization: `Bearer ${$appSession.tokens.gitlab}`
|
Authorization: `Bearer ${$appSession.tokens.gitlab}`
|
||||||
});
|
});
|
||||||
username = user.username;
|
username = user.username;
|
||||||
|
await loadGroups();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return await getGitlabToken();
|
loading.base = false;
|
||||||
|
tryAgain = true;
|
||||||
}
|
}
|
||||||
await loadGroups();
|
|
||||||
});
|
});
|
||||||
function selectGroup(event: any) {
|
function selectGroup(event: any) {
|
||||||
selected.group = event.detail;
|
selected.group = event.detail;
|
||||||
@ -104,7 +106,7 @@
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const params: any = new URLSearchParams({
|
const params: any = new URLSearchParams({
|
||||||
page,
|
page,
|
||||||
per_page: perPage,
|
per_page: perPage
|
||||||
});
|
});
|
||||||
loading.base = true;
|
loading.base = true;
|
||||||
try {
|
try {
|
||||||
@ -418,5 +420,17 @@
|
|||||||
class:hover:bg-orange-500={showSave && !loading.save}
|
class:hover:bg-orange-500={showSave && !loading.save}
|
||||||
>{loading.save ? $t('forms.saving') : $t('forms.save')}</button
|
>{loading.save ? $t('forms.saving') : $t('forms.save')}</button
|
||||||
>
|
>
|
||||||
|
{#if tryAgain}
|
||||||
|
<div>
|
||||||
|
An error occured during authenticating with GitLab. Please check your GitLab Source
|
||||||
|
configuration <a href={`/sources/${application.gitSource.id}`}>here.</a>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
class="w-40 bg-green-600"
|
||||||
|
on:click|stopPropagation|preventDefault={() => window.location.reload()}
|
||||||
|
>
|
||||||
|
Try again
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user