mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-01-23 03:07:05 +00:00
clean up
This commit is contained in:
parent
1589d2a8f5
commit
7192690c1c
@ -1,5 +1,4 @@
|
|||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
import { parseCookies } from './parseCookies';
|
|
||||||
import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
|
import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
|
||||||
import type { ProviderInfo } from '~/types/model';
|
import type { ProviderInfo } from '~/types/model';
|
||||||
|
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
export function parseCookies(cookieHeader: string) {
|
|
||||||
const cookies: any = {};
|
|
||||||
|
|
||||||
// Split the cookie string by semicolons and spaces
|
|
||||||
const items = cookieHeader.split(';').map((cookie) => cookie.trim());
|
|
||||||
|
|
||||||
items.forEach((item) => {
|
|
||||||
const [name, ...rest] = item.split('=');
|
|
||||||
|
|
||||||
if (name && rest) {
|
|
||||||
// Decode the name and value, and join value parts in case it contains '='
|
|
||||||
const decodedName = decodeURIComponent(name.trim());
|
|
||||||
const decodedValue = decodeURIComponent(rest.join('=').trim());
|
|
||||||
cookies[decodedName] = decodedValue;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return cookies;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user