-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Electrium-Mobility/next-js-update
updated breaking changes for next-js 15
- Loading branch information
Showing
10 changed files
with
46 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,29 @@ | ||
import { createServerClient, type CookieOptions } from "@supabase/ssr"; | ||
import { createServerClient } from "@supabase/ssr"; | ||
import { cookies } from "next/headers"; | ||
|
||
export const createClient = () => { | ||
const cookieStore = cookies(); | ||
export const createClient = async () => { | ||
const cookieStore = await cookies(); | ||
|
||
return createServerClient( | ||
process.env.NEXT_PUBLIC_SUPABASE_URL!, | ||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, | ||
{ | ||
cookies: { | ||
get(name: string) { | ||
return cookieStore.get(name)?.value; | ||
}, | ||
set(name: string, value: string, options: CookieOptions) { | ||
try { | ||
cookieStore.set({ name, value, ...options }); | ||
} catch (error) { | ||
// The `set` method was called from a Server Component. | ||
// This can be ignored if you have middleware refreshing | ||
// user sessions. | ||
} | ||
}, | ||
remove(name: string, options: CookieOptions) { | ||
try { | ||
cookieStore.set({ name, value: "", ...options }); | ||
} catch (error) { | ||
// The `delete` method was called from a Server Component. | ||
// This can be ignored if you have middleware refreshing | ||
// user sessions. | ||
} | ||
process.env.NEXT_PUBLIC_SUPABASE_URL!, | ||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, | ||
{ | ||
cookies: { | ||
getAll() { | ||
return cookieStore.getAll(); | ||
}, | ||
setAll(cookiesToSet) { | ||
try { | ||
cookiesToSet.forEach(({ name, value, options }) => { | ||
cookieStore.set(name, value, options); | ||
}); | ||
} catch (error) { | ||
// The `set` method was called from a Server Component. | ||
// This can be ignored if you have middleware refreshing | ||
// user sessions. | ||
} | ||
}, | ||
}, | ||
}, | ||
}, | ||
); | ||
}; |