Skip to content

Instantly share code, notes, and snippets.

View Stiropor's full-sized avatar
💭
Turning coffee into code

Marko Stiropor

💭
Turning coffee into code
View GitHub Profile
@Stiropor
Stiropor / auth.js
Last active September 8, 2022 14:38
Nuxt3 auth demo
import { nextTick } from 'vue'
export const useProperCookie = () => useCookie('proper_token')
export const useAuthFetch = (url, fetchOptions = {}) => {
return $fetch(url, {
baseURL: 'https://l9.test/api/v1',
...fetchOptions,
headers: {
Authorization: `Bearer ${useProperCookie().value}`,
...fetchOptions.headers,
@Stiropor
Stiropor / ModifyHeadersMiddleware.php
Last active November 12, 2020 14:25
Laravel CORS middleware that fuckin' worked!
<?php
# By @andregarcia013 from https://github.com/fruitcake/laravel-cors/issues/471#issuecomment-651505665
namespace App\Http\Middleware;
use Closure;
class CORS
{