sveltejs / realworld

SvelteKit implementation of the RealWorld app
https://realworld.svelte.dev
MIT License
2.24k stars 353 forks source link

Profile page Error #85

Closed benjaminviaud closed 3 years ago

benjaminviaud commented 3 years ago

Hello,

When I clone the last version and I go to the profile page it gives an error

500 Unexpected token T in JSON at position 0 SyntaxError: Unexpected token T in JSON at position 0

Index.json.js

import * as api from '$lib/api.js';

export async function get({ params, context }) {
    const { profile } = await api.get(`profiles/${params.user}`, context.user && context.user.token);

    return {
        body: profile
    };
}

context must be locals

benmccann commented 3 years ago

hopefully fixed now