fix(frontend): finish auth when redirect URI is supplied (#3191)
- Fixes #3188 - Refactors if-else statement into ternary
This commit is contained in:
parent
1e09305fb3
commit
e368e35e74
@ -104,22 +104,15 @@ export const initAuth = async (oldToken = null) => {
|
|||||||
return auth;
|
return auth;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAuthUrl = (provider, redirect = "") => {
|
export const getAuthUrl = (provider, redirect = "/dashboard") => {
|
||||||
const config = useRuntimeConfig();
|
const config = useRuntimeConfig();
|
||||||
const route = useNativeRoute();
|
const route = useNativeRoute();
|
||||||
|
|
||||||
if (redirect === "") {
|
const fullURL = route.query.launcher
|
||||||
redirect = route.path;
|
? "https://launcher-files.modrinth.com"
|
||||||
}
|
: `${config.public.siteUrl}/auth/sign-in?redirect=${redirect}`;
|
||||||
|
|
||||||
let fullURL;
|
return `${config.public.apiBaseUrl}auth/init?provider=${provider}&url=${encodeURIComponent(fullURL)}`;
|
||||||
if (route.query.launcher) {
|
|
||||||
fullURL = `https://launcher-files.modrinth.com`;
|
|
||||||
} else {
|
|
||||||
fullURL = `${config.public.siteUrl}${redirect}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${config.public.apiBaseUrl}auth/init?provider=${provider}&url=${fullURL}`;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const removeAuthProvider = async (provider) => {
|
export const removeAuthProvider = async (provider) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user