fix: Re-write Nuxt auth backend and get rid of sidebase auth (#6322)

This commit is contained in:
Michael Genson
2025-10-05 20:43:38 -05:00
committed by GitHub
parent fffe7b05e0
commit 6895b49543
30 changed files with 182 additions and 78 deletions

View File

@@ -1,9 +1,9 @@
import { ref, watch, computed } from "vue";
import { useAuthBackend } from "~/composables/useAuthBackend";
import type { UserOut } from "~/lib/api/types/user";
export const useMealieAuth = function () {
const auth = useAuth();
const { setToken } = useAuthState();
const auth = useAuthBackend();
const { $axios } = useNuxtApp();
// User Management
@@ -40,7 +40,7 @@ export const useMealieAuth = function () {
async function oauthSignIn() {
const params = new URLSearchParams(window.location.search);
const { data: token } = await $axios.get<{ access_token: string; token_type: "bearer" }>("/api/auth/oauth/callback", { params });
setToken(token.access_token);
auth.setToken(token.access_token);
await auth.getSession();
}
@@ -49,7 +49,6 @@ export const useMealieAuth = function () {
loggedIn,
signIn: auth.signIn,
signOut: auth.signOut,
signUp: auth.signUp,
refresh: auth.refresh,
oauthSignIn,
};