👽 Update to use new realm filter

This commit is contained in:
LittleSheep 2024-08-19 00:44:35 +08:00
parent 6aadffb72b
commit ca253eb87b
7 changed files with 11 additions and 11 deletions

2
.env
View File

@ -1,4 +1,4 @@
NUXT_PUBLIC_SOLAR_REALM_ID=2 NUXT_PUBLIC_SOLAR_REALM=solar-network
NUXT_PUBLIC_SITE_URL=https://solsynth.dev NUXT_PUBLIC_SITE_URL=https://solsynth.dev
NUXT_PUBLIC_SOLAR_NETWORK_API=https://api.sn.solsynth.dev NUXT_PUBLIC_SOLAR_NETWORK_API=https://api.sn.solsynth.dev
NUXT_PUBLIC_SOLIAN_URL=https://sn.solsynth.dev NUXT_PUBLIC_SOLIAN_URL=https://sn.solsynth.dev

View File

@ -7,7 +7,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps<{ author?: string, tag?: string, category?: string, realmId?: number }>() const props = defineProps<{ author?: string, tag?: string, category?: string, realm?: string }>()
const config = useRuntimeConfig() const config = useRuntimeConfig()
@ -22,8 +22,8 @@ async function loadPost({ done }: any) {
if (props.author) { if (props.author) {
searchQueries.set("author", props.author) searchQueries.set("author", props.author)
} }
if (props.realmId) { if (props.realm) {
searchQueries.set("realmId", props.realmId.toString()) searchQueries.set("realm", props.realm)
} }
if (props.tag) { if (props.tag) {

View File

@ -21,7 +21,7 @@ const loading = ref(false)
async function load() { async function load() {
loading.value = true loading.value = true
const res = await fetch(`${config.public.solarNetworkApi}/cgi/co/posts?take=5&realmId=${config.public.solarRealmId}`) const res = await fetch(`${config.public.solarNetworkApi}/cgi/co/posts?take=5&realm=${config.public.solarRealm}`)
const result = await res.json() const result = await res.json()
items.value.push(...result.data) items.value.push(...result.data)

View File

@ -49,7 +49,7 @@ export default defineNuxtConfig({
runtimeConfig: { runtimeConfig: {
public: { public: {
siteUrl: "https://solsynth.dev", siteUrl: "https://solsynth.dev",
solarRealmId: 2, solarRealm: "solar-network",
solarNetworkApi: "https://api.sn.solsynth.dev", solarNetworkApi: "https://api.sn.solsynth.dev",
solianUrl: "https://sn.solsynth.dev", solianUrl: "https://sn.solsynth.dev",
}, },

View File

@ -5,7 +5,7 @@
<span>{{ t("navActivityCaption") }}</span> <span>{{ t("navActivityCaption") }}</span>
</div> </div>
<post-list :realm-id="config.public.solarRealmId" /> <post-list :realm="config.public.solarRealm" />
</v-container> </v-container>
</template> </template>

View File

@ -5,7 +5,7 @@
<span>{{ t("navPostsCaptionWithRealm", [`#${route.params.id}`]) }}</span> <span>{{ t("navPostsCaptionWithRealm", [`#${route.params.id}`]) }}</span>
</div> </div>
<post-list :realm-id="parseInt(route.params.id?.toString())" /> <post-list :realm="route.params.id?.toString()" />
</v-container> </v-container>
</template> </template>

View File

@ -23,7 +23,7 @@ export default defineEventHandler(async (event) => {
take?: number, take?: number,
offset?: number, offset?: number,
type?: "atom" | "json" | "rss", type?: "atom" | "json" | "rss",
realmId?: number, realm?: string,
author?: string, author?: string,
}>(event) }>(event)
@ -32,8 +32,8 @@ export default defineEventHandler(async (event) => {
"offset": (queries.offset ?? 0).toString(), "offset": (queries.offset ?? 0).toString(),
}) })
if (queries.realmId) { if (queries.realm) {
searchQuery.set("realmId", queries.realmId.toString()) searchQuery.set("realm", queries.realm.toString())
} }
if (queries.author) { if (queries.author) {
searchQuery.set("author", queries.author) searchQuery.set("author", queries.author)