netwrx
netwrx
Explore posts from servers
NNuxt
Created by netwrx on 3/29/2024 in #❓・help
No session created - nuxt auth utils
export default oauth.discordEventHandler({
config: {
emailRequired: false,
profileRequired: true,
scope: ["guilds"],
},
async onSuccess(event, { user, tokens }) {
console.log(user.username);
await setUserSession(event, {
user: {
username: user.username,
},
});
return sendRedirect(event, "/");
},
// Optional, will return a json error and 401 status code by default
onError(event, error) {
console.error("Discord OAuth error:", error);
return sendRedirect(event, "/");
},
});
export default oauth.discordEventHandler({
config: {
emailRequired: false,
profileRequired: true,
scope: ["guilds"],
},
async onSuccess(event, { user, tokens }) {
console.log(user.username);
await setUserSession(event, {
user: {
username: user.username,
},
});
return sendRedirect(event, "/");
},
// Optional, will return a json error and 401 status code by default
onError(event, error) {
console.error("Discord OAuth error:", error);
return sendRedirect(event, "/");
},
});
No cookies, and no session is set after a successful auth. Even logging the session directly afterwards shows good data and it was set. But nada.
47 replies
NNuxt
Created by netwrx on 3/27/2024 in #❓・help
useFetch and queries will not re-fetch with watch array of reactive values
const route = useRoute();

const page = ref<number>(0);
const category = ref<string>(route.query.category?.toString() || "");

const {
data: servers,
refresh: refreshServers,
pending: servers_pending,
} = useFetch("/api/v1/stuff/fetch/feed", {
query: { page: page.value, category: category.value },
watch: [page, category],
});
const route = useRoute();

const page = ref<number>(0);
const category = ref<string>(route.query.category?.toString() || "");

const {
data: servers,
refresh: refreshServers,
pending: servers_pending,
} = useFetch("/api/v1/stuff/fetch/feed", {
query: { page: page.value, category: category.value },
watch: [page, category],
});
Any help is appreciated 😄
18 replies
NNuxt
Created by netwrx on 3/26/2024 in #❓・help
Missing type definitions when using useFetch for a dynamic route
const route = useRoute();
const id = route.params.id;

const { data: stuff, pending: stuff_pending } = useFetch(
`/api/v1/stuff/fetch/${id}`
);
const route = useRoute();
const id = route.params.id;

const { data: stuff, pending: stuff_pending } = useFetch(
`/api/v1/stuff/fetch/${id}`
);
31 replies
NNuxt
Created by netwrx on 3/26/2024 in #❓・help
200+ requests on a SSR simple page
Like this is so silly, it's just a bunch of random crap like scripts fonts and icons. Is this just how ssr works?
8 replies