Skip to content

Instantly share code, notes, and snippets.

View davidparys's full-sized avatar
🎯
Focusing

David Parys davidparys

🎯
Focusing
View GitHub Profile
@davidparys
davidparys / frontend.vue
Created March 21, 2025 17:52
Supabase Nuxt
<script setup lang="ts">
const deleteAccount = async () => {
try {
const data = await $fetch<{ success: boolean; message: string }>(
"/api/user/delete",
{
method: "DELETE",
}
);
await useSupabaseClient().auth.signOut();
<!-- invoice -->
<html>
<head>
<link href='https://my.sevdesk.de/assets/fonts/OpenSans.css' rel='stylesheet' type='text/css'>
<style>
@font-face {
font-family: 'ocrb';
src: url('https://my.sevdesk.de/assets/fonts/OcrB/ocrb.ttf');
}
@davidparys
davidparys / composable.ts
Created March 1, 2025 18:18
Typed fetch for api routes in nuxt
// composables/useTypedFetch.ts
import type { UseFetchOptions } from 'nuxt/app'
import type { InternalApi } from 'nitropack'
import type { ApiRoutes, ApiResponse } from './apiResponse'
export const useTypedFetch = <T extends ApiRoutes, M extends keyof InternalApi[T]>(
route: T,
method: M,
opts?: Omit<UseFetchOptions<ApiResponse<T, M>>, 'method'>
) => {
<script setup lang="ts">
const {
coursesEn,
coursesDe,
isLoading,
learndashEn
} = useLearndashCache()
// Example of using SWR pattern for a specific course
const useCourse = async (id: string) => {