20 lines
357 B
TypeScript
20 lines
357 B
TypeScript
|
import { browser } from '$app/env';
|
||
|
|
||
|
const protocol = browser ? window.location.protocol : 'http:';
|
||
|
const pathPrefix = protocol + '//api.playcode.quest';
|
||
|
|
||
|
export const withToken = (token: string): any => {
|
||
|
return {
|
||
|
pathPrefix,
|
||
|
headers: {
|
||
|
Authorization: `Bearer ${token}`
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
|
||
|
export const noToken = (): any => {
|
||
|
return {
|
||
|
pathPrefix
|
||
|
};
|
||
|
};
|