CS
CS
Explore posts from servers
NNuxt
Created by Tumulte on 8/21/2024 in #❓・help
How do you refresh a fetch with a dynamic path (/api/page/[id])
I think useAsyncData would do the trick, where your call function uses what Cake commented here earlier
11 replies
NNuxt
Created by CS on 4/21/2024 in #❓・help
Route switching when using i18n setLocale doesn't work...?
Yeah I have a lot to learn with it too :D
19 replies
NNuxt
Created by CS on 4/21/2024 in #❓・help
Route switching when using i18n setLocale doesn't work...?
Thanks for the help though! Appreciated
19 replies
NNuxt
Created by CS on 4/21/2024 in #❓・help
Route switching when using i18n setLocale doesn't work...?
And yeah, this version does seem to work, I'm just confused why the others (with switchLocalePath and all) didn't :d
19 replies
NNuxt
Created by CS on 4/21/2024 in #❓・help
Route switching when using i18n setLocale doesn't work...?
npnp
19 replies
NNuxt
Created by CS on 4/21/2024 in #❓・help
Route switching when using i18n setLocale doesn't work...?
No description
19 replies
NNuxt
Created by CS on 4/21/2024 in #❓・help
Route switching when using i18n setLocale doesn't work...?
No description
19 replies
NNuxt
Created by CS on 4/21/2024 in #❓・help
Route switching when using i18n setLocale doesn't work...?
My nuxt config (i18n) by the way, in case it helps:
i18n: {
locales: [
{
code: "en-US",
iso: "en",
file: "en-US.json",
name: "English",
icon: "emojione:flag-for-united-states",
},
{
code: "de-DE",
iso: "de",
file: "de-DE.json",
name: "Deutsch",
icon: "emojione:flag-for-germany",
},
],
defaultLocale: "en-US",
detectBrowserLanguage: {
fallbackLocale: "en-US",
},
langDir: "./locales/",
vueI18n: "./i18n.config.ts",
strategy: "prefix_except_default",
lazy: true,
},
i18n: {
locales: [
{
code: "en-US",
iso: "en",
file: "en-US.json",
name: "English",
icon: "emojione:flag-for-united-states",
},
{
code: "de-DE",
iso: "de",
file: "de-DE.json",
name: "Deutsch",
icon: "emojione:flag-for-germany",
},
],
defaultLocale: "en-US",
detectBrowserLanguage: {
fallbackLocale: "en-US",
},
langDir: "./locales/",
vueI18n: "./i18n.config.ts",
strategy: "prefix_except_default",
lazy: true,
},
19 replies
NNuxt
Created by CS on 4/21/2024 in #❓・help
Route switching when using i18n setLocale doesn't work...?
You mean with this?
19 replies
NNuxt
Created by CS on 4/21/2024 in #❓・help
Route switching when using i18n setLocale doesn't work...?
Yeah I'm pretty sure setLocale(code) was in fact setting the cookie -> but it wasn't changing the route params (the prefixes)
19 replies
NNuxt
Created by CS on 4/21/2024 in #❓・help
Route switching when using i18n setLocale doesn't work...?
After some more random testing, this here seems to work, but i'm just still stumped, why the other cases don't really seem to do it for me...?
<template>
<nav>
<div class="nav-icons">
<NuxtLink
v-for="language in locales"
:key="language.code"
class="language"
:class="{ active: locale === language.code }"
:to="localeRoute($route.path, language.code)"
>
<Icon :name="language.icon" />
<span>{{ language.name }}</span>
</NuxtLink>
</div>
<div class="links">
<NuxtLink v-for="link in links" :key="link.to" :to="localePath(link.to)">{{ link.text }}</NuxtLink>
<NuxtLink :to="localePath({ path: '/', hash: '#sport-select' })">Sport Selection</NuxtLink>
</div>
</nav>
</template>

<script lang="ts" setup>
const { locale, locales } = useI18n();
const localePath = useLocalePath();
const localeRoute = useLocaleRoute();
</script>
<template>
<nav>
<div class="nav-icons">
<NuxtLink
v-for="language in locales"
:key="language.code"
class="language"
:class="{ active: locale === language.code }"
:to="localeRoute($route.path, language.code)"
>
<Icon :name="language.icon" />
<span>{{ language.name }}</span>
</NuxtLink>
</div>
<div class="links">
<NuxtLink v-for="link in links" :key="link.to" :to="localePath(link.to)">{{ link.text }}</NuxtLink>
<NuxtLink :to="localePath({ path: '/', hash: '#sport-select' })">Sport Selection</NuxtLink>
</div>
</nav>
</template>

<script lang="ts" setup>
const { locale, locales } = useI18n();
const localePath = useLocalePath();
const localeRoute = useLocaleRoute();
</script>
19 replies
NNuxt
Created by CS on 4/21/2024 in #❓・help
Route switching when using i18n setLocale doesn't work...?
19 replies
DTDrizzle Team
Created by CS on 3/24/2024 in #help
What am I doing wrong with migrations?
Ah found it in another answer here from last year: define the callback in a references function as AnyMySqlColumn
19 replies
DTDrizzle Team
Created by CS on 3/24/2024 in #help
What am I doing wrong with migrations?
No description
19 replies
DTDrizzle Team
Created by CS on 3/24/2024 in #help
What am I doing wrong with migrations?
Ok I think I fixed my problem, it was something stupid from my side... (a small typo basically)
19 replies
DTDrizzle Team
Created by CS on 3/24/2024 in #help
What am I doing wrong with migrations?
But I have no clue why this is happening in my update query
19 replies
DTDrizzle Team
Created by CS on 3/24/2024 in #help
What am I doing wrong with migrations?
At the part where it's trying to access col.name apparently
19 replies
DTDrizzle Team
Created by CS on 3/24/2024 in #help
What am I doing wrong with migrations?
The error seems to stem from this part though:
buildUpdateSet(table: MySqlTable, set: UpdateSet): SQL {
const tableColumns = table[Table.Symbol.Columns];

const columnNames = Object.keys(tableColumns).filter((colName) =>
set[colName] !== undefined || tableColumns[colName]?.onUpdateFn !== undefined
);

const setSize = columnNames.length;
return sql.join(columnNames.flatMap((colName, i) => {
const col = tableColumns[colName]!;

const value = set[colName] ?? sql.param(col.onUpdateFn!(), col);
const res = sql`${sql.identifier(col.name)} = ${value}`;

if (i < setSize - 1) {
return [res, sql.raw(', ')];
}
return [res];
}));
}
buildUpdateSet(table: MySqlTable, set: UpdateSet): SQL {
const tableColumns = table[Table.Symbol.Columns];

const columnNames = Object.keys(tableColumns).filter((colName) =>
set[colName] !== undefined || tableColumns[colName]?.onUpdateFn !== undefined
);

const setSize = columnNames.length;
return sql.join(columnNames.flatMap((colName, i) => {
const col = tableColumns[colName]!;

const value = set[colName] ?? sql.param(col.onUpdateFn!(), col);
const res = sql`${sql.identifier(col.name)} = ${value}`;

if (i < setSize - 1) {
return [res, sql.raw(', ')];
}
return [res];
}));
}
19 replies
DTDrizzle Team
Created by CS on 3/24/2024 in #help
What am I doing wrong with migrations?
I think the console logs with file locations aren't that important, since it's obviously finding those files
19 replies
DTDrizzle Team
Created by CS on 3/24/2024 in #help
What am I doing wrong with migrations?
Using npm
19 replies