Properly export and import the mergePath helper (#75)

* Correctly import `mergePath`

* Export `mergePath`
This commit is contained in:
ohmree 2022-07-22 19:57:18 +03:00 committed by GitHub
parent 19bff9a39c
commit ca3cca1d6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,4 @@
function mergePath(basePaths: (string | null)[], path: string) { export function mergePath(basePaths: (string | null)[], path: string) {
if (path.startsWith("/")) { if (path.startsWith("/")) {
path = path.slice(1); path = path.slice(1);
} }

View File

@ -2,6 +2,7 @@
import { page } from "@sveltejs/kit/assets/runtime/app/stores"; */ import { page } from "@sveltejs/kit/assets/runtime/app/stores"; */
import type { LoadInput } from "@sveltejs/kit"; import type { LoadInput } from "@sveltejs/kit";
import type { ClientRequestConfig } from "./types"; import type { ClientRequestConfig } from "./types";
import { mergePath } from "./helpers";
interface SignInConfig extends ClientRequestConfig { interface SignInConfig extends ClientRequestConfig {
redirectUrl?: string; redirectUrl?: string;

View File

@ -1,6 +1,7 @@
/* import { session as session$ } from "$app/stores"; */ /* import { session as session$ } from "$app/stores"; */
import type { ClientRequestConfig } from "./types"; import type { ClientRequestConfig } from "./types";
import { mergePath } from "./helpers";
export async function signOut(config?: ClientRequestConfig) { export async function signOut(config?: ClientRequestConfig) {
let res = await fetch(mergePath(["/api/auth", config?.basePath ?? null], "signout"), { let res = await fetch(mergePath(["/api/auth", config?.basePath ?? null], "signout"), {