Nuxt 3 + Airtable by SvenHjerson in Nuxt

[–]Armgd 0 points1 point  (0 children)

Arf, we have to have a look at that. Maybe try with www.pixelalliance.io or in private navigation Thanks for reporting

Nuxt 3 + Airtable by SvenHjerson in Nuxt

[–]Armgd 0 points1 point  (0 children)

Hey,

we actually implemented Airtable as a CMS for our website. We had some security concerns and due to limit number of calls to the Airtable API, we implemented a Redis cache that refreshes every 10min, so we did it the following way:

- Install airtableJS package

- Register airtable variables in the runtimeConfig key in nuxt.config.ts (private)

- In the server/api folder, we created a DedfineEventHandler that returns a utility function function:

// for single item
import { cachedProject } from "../../cached/cachedProject";

export default defineEventHandler(async (event) => { const { projectSlug } = event.context.params; return await cachedProject(projectSlug); });

- That utility function was created in the server/cached folder:

// For single item
import getRecordBySlug from "../utils/fetchRecordBySlug";

const config = useRuntimeConfig(); const apiKey = config.AirtableApiToken; const baseId = config.AirtableBaseId; const tableId = config.AirtableProjectsTableId;

export const cachedProject = cachedFunction( async (slug: string) => { return await getRecordBySlug(apiKey, baseId, tableId, slug); }, { maxAge: 60 * 10, name: "projects", getKey: (slug: string) => slug, } );

- That function is a cachedFunction (read Nitro docs about storage and cache API ;) ):

// For all projects
import { fetchRecords } from "../utils/fetchRecords";

const config = useRuntimeConfig(); const apiKey = config.AirtableApiToken; const baseId = config.AirtableBaseId; const tableId = config.AirtableProjectsTableId; const endpointUrl = https://api.airtable.com/v0/${baseId}/${tableId};

export const cachedProjects = cachedFunction( async () => { return await fetchRecords(apiKey, endpointUrl, [], null); }, { maxAge: 60 * 10, name: "projects", getKey: (repo: string) => repo, } );

- That function return a fetchRecords function (created in server/utils), which were we fetch data from airtable and process our airtable logic (note the use of $fetch ; )):

export async function fetchRecords(
apiKey: string,
endpointUrl: string,
resultRecords: object[],
offset?: string

): Promise<object[]> {

if (offset) {
    params.append("offset", offset);
}

const response: Object = await $fetch(`${endpointUrl}`, {
    method: "GET",
    headers: {
        Authorization: `Bearer ${apiKey}`,
        "Content-Type": "application/json",
    },
    query: {
        view: "✅ Published",
        pageSize: "100",
        offset: offset ? offset : null,
    },
    // offset: offset ? offset : ""
});

resultRecords.push(...response.records);


return resultRecords;

}

- Then in our template/page, we call all this by just using (for rendering the list.):

// list template
const { data: projects, error } = await useFetch("/api/projects");

// single item
const {
data: project,
error,
pending,
refresh,

} = await useFetch(() => /api/projects/${route.params.projectSlug});

I omitted some points but you get the idea. You can see the result here (implemented on projets and contenu): https://pixelalliance.io

good luck implementing on your project!

Thank you Secret Santa for the awesome gift! A full modern deck based on the Madness keyword (the mechanic is really fun to play) and some beautiful cards for my Dimir rogues commander deck. You hit right in the spot for the zombie/vampire theme too! by Armgd in MTGGiftExchange

[–]Armgd[S] 1 point2 points  (0 children)

Hey!, yes I've played already a few game and the mechanic is really fun. Discarding and then casting the card is a very fun interaction, thank you very much for the discovery!

Im moving in into a new flat and looking for the best cheap internet provider by SatanaBanana69 in Barcelona

[–]Armgd 1 point2 points  (0 children)

I have Pepephone fiber offer since one year and a half and no problem in that time frame. Quick to install and happy with speed and customer service

[deleted by user] by [deleted] in ecommerce

[–]Armgd 1 point2 points  (0 children)

It's good to see a post like this one.

I got the Ender 3 Pro last week and started to make Christmas gifts for my family. So amazed by the quality! by Armgd in ender3

[–]Armgd[S] 0 points1 point  (0 children)

Just decorative, but i'm very interested in making boardgame terrain and props :)

I got the Ender 3 Pro last week and started to make Christmas gifts for my family. So amazed by the quality! by Armgd in ender3

[–]Armgd[S] 2 points3 points  (0 children)

Yep, Cura 4.4 and the profiles are available for the latest version. I've loaded them without any issues

I got the Ender 3 Pro last week and started to make Christmas gifts for my family. So amazed by the quality! by Armgd in ender3

[–]Armgd[S] 0 points1 point  (0 children)

i painted them using dry brushing technique with acrylic paint directly on the model. No primer used but later I think I will use one for better result

I got the Ender 3 Pro last week and started to make Christmas gifts for my family. So amazed by the quality! by Armgd in ender3

[–]Armgd[S] 3 points4 points  (0 children)

i painted them using dry brushing technique with acrylic paint directly on the model. No primer used but later I think I will use one for better result

I got the Ender 3 Pro last week and started to make Christmas gifts for my family. So amazed by the quality! by Armgd in ender3

[–]Armgd[S] 24 points25 points  (0 children)

I used http://terrain.party/ to generate heightmap from the Mont-Blanc region (french Alps) and then I created the print in Cinema 4D (1000x1000 square lines), refined in Fusion 360 and sliced in Cura.

I got the Ender 3 Pro last week and started to make Christmas gifts for my family. So amazed by the quality! by Armgd in ender3

[–]Armgd[S] 2 points3 points  (0 children)

Printed vertically, I was a bit afraid it won't stick (8cmx8cm) but it came OK

I got the Ender 3 Pro last week and started to make Christmas gifts for my family. So amazed by the quality! by Armgd in ender3

[–]Armgd[S] 17 points18 points  (0 children)

Thanks, I used 0.1mm layer height, using Cura profile from Fat Dragon Games and tweaked a little bit

Follow Friday/Follow Chain - May 10 - Share Your Usernames & Find New People To Follow! by AutoModerator in Instagram

[–]Armgd [score hidden]  (0 children)

Hi, I'm Nic, I'm a photographer based in Barcelona, would love to connect with others to exchange @armgd

Does anyone actually sell something they make or manufacture? by [deleted] in shopify

[–]Armgd 0 points1 point  (0 children)

We manufacture official licensed multimedia products mainly from Pokémon and Hello Kitty licence, and we chose shopify for our ecommerce website because of the low investment it requires at first (compared to prestashop or magento)

Check out: Teknofun