Skip to content

Commit

Permalink
Merge pull request #12 from shinosaki/11-solved-500-error
Browse files Browse the repository at this point in the history
11 solved 500 error
  • Loading branch information
shinosaki authored Aug 14, 2023
2 parents 5314572 + 0b16ab9 commit 649e935
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 31 deletions.
2 changes: 1 addition & 1 deletion front/.env.development
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PUBLIC_API_ENDPOINT = /api
PUBLIC_API_ENDPOINT = http://localhost:8787/api
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { redirect } from "@sveltejs/kit";
import { PUBLIC_API_ENDPOINT } from '$env/static/public';

export const load = async ({ fetch }) => {
export const load = async ({ cookies, fetch }) => {
const res = await fetch(`${PUBLIC_API_ENDPOINT}/v1/ping`, {
credentials: 'include'
headers: {
cookie: cookies.get('id')
}
});

if (res.status === 200) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { PUBLIC_API_ENDPOINT } from '$env/static/public';

export const load = async ({ fetch }) => {
const { status } = await fetch(`${PUBLIC_API_ENDPOINT}/auth/register`, {
credentials: 'include'
}).then(r=>r.json());
export const load = async ({ cookies, fetch }) => {
const { status } = await fetch(`${PUBLIC_API_ENDPOINT}/auth/register`).then(r=>r.json());

return {
status
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { redirect } from "@sveltejs/kit";
import { PUBLIC_API_ENDPOINT } from '$env/static/public';

export const load = async ({ fetch }) => {
export const load = async ({ cookies, fetch }) => {
const res = await fetch(`${PUBLIC_API_ENDPOINT}/v1/ping`, {
credentials: 'include'
headers: {
cookie: cookies.get('id')
}
});

if (res.status === 401) {
Expand Down
11 changes: 0 additions & 11 deletions front/src/routes/(mail)/i/inbox/+page.js

This file was deleted.

13 changes: 13 additions & 0 deletions front/src/routes/(mail)/i/inbox/+page.server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { PUBLIC_API_ENDPOINT } from '$env/static/public';

export const load = async ({ cookies, fetch }) => {
const messages = await fetch(`${PUBLIC_API_ENDPOINT}/v1/messages`, {
headers: {
cookie: cookies.get('id')
}
}).then(r=>r.json());

return {
messages
};
}
11 changes: 0 additions & 11 deletions front/src/routes/(mail)/i/message/[id]/+page.js

This file was deleted.

13 changes: 13 additions & 0 deletions front/src/routes/(mail)/i/message/[id]/+page.server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { PUBLIC_API_ENDPOINT } from '$env/static/public';

export const load = async ({ cookies, fetch, params }) => {
const message = await fetch(`${PUBLIC_API_ENDPOINT}/v1/message/${params.id}`, {
headers: {
cookie: cookies.get('id')
}
}).then(r=>r.json());

return {
message
};
}
1 change: 1 addition & 0 deletions front/wrangler.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name = "workers-mail-front"

0 comments on commit 649e935

Please sign in to comment.