Skip to content

Instantly share code, notes, and snippets.

View axmad386's full-sized avatar
🚀
working hard

Akhmad Salafudin axmad386

🚀
working hard
View GitHub Profile
@axmad386
axmad386 / API.ts
Last active September 3, 2021 03:26
API wrapper for Svelte
// src/lib/Support/Http/API.ts
import Axios from 'axios'
import {get} from "svelte/store"
import {Errors$} from "$lib/Support/Store/Error"
import { Auth$ } from '$lib/Support/Store/Auth'
import type {TApiCall} from "$lib/Contract/Http"
import {BASE_API} from "$lib/Env"
import {goto} from "$app/navigation"
import Toast from "$lib/Support/Store/Toast"