Comments (10)
@Sebring @toby3d it does work, I needed to copy the contents of _api.js
file and paste it into /src/node_modules/api.js
, and then also replace import { post } from 'utils.js';
with import { post } from 'api.js';
in three files:
src/routes/login/index.svelte
src/routes/register/index.svelte
src/routes/settings/index.svelte
from realworld.
The problem is that src/routes/login/index.svelte makes a call to 'auth/login'. This call is handled on the server, which make a minor adjustment to the JSON and forwards it to the Conduit server (I'm not sure why, perhaps just to demonstrate some providing a server API). The calls in api.js will always prefix that uri with https://conduit.productionready.io/api. So, the calls were going to 'auth/login' on the Conduit server and there is no such URI. I've created a pull request to address this. But there may be a better place to put api.js and utils.js to reduce all of the "../../.." in the relative references.
from realworld.
You can peek the old file in the repo here before it was deleted.
3c61ad4#diff-17e46da7586caf4f665a809c16049d6b
from realworld.
@Sebring This does not solve the problem:
Details
> npm run dev
> [email protected] dev /home/toby3d/git/realworld
> sapper dev
• client
'api.js' is imported by src/routes/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/[slug].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_ArticleMeta.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/editor/[slug].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/editor/_Editor.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_Comment.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_CommentInput.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/register/index.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/settings/index.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/login/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/[view].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/_Profile.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/_components/ArticleList/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/_components/ArticleList/ArticlePreview.svelte, but could not be resolved – treating it as an external dependency
• server
'api.js' is imported by src/routes/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/auth/register.js, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/auth/login.js, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/auth/save.js, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/[slug].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_ArticleMeta.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/editor/[slug].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/editor/_Editor.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_Comment.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_CommentInput.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/register/index.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/settings/index.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/login/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/[view].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/_Profile.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/_components/ArticleList/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/_components/ArticleList/ArticlePreview.svelte, but could not be resolved – treating it as an external dependency
'del' is imported from external module 'api.js' but never used
✔ service worker (34ms)
internal/modules/cjs/loader.js:670
throw err;
^
Error: Cannot find module 'api.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
at Function.Module._load (internal/modules/cjs/loader.js:591:27)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/home/toby3d/git/realworld/__sapper__/dev/server/server.js:13:11)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)
> Server crashed
from realworld.
Did you re-create api.js
?
Looks like you need to do the same to util.js
from realworld.
@Sebring @toby3d it does work, I needed to copy the contents of
_api.js
file and paste it into/src/node_modules/api.js
, and then also replaceimport { post } from 'utils.js';
withimport { post } from 'api.js';
in three files:
src/routes/login/index.svelte
src/routes/register/index.svelte
src/routes/settings/index.svelte
it ok but can't login
from realworld.
@m4v3r I reproduce your fixes and find 404 on editor and profile pages.
from realworld.
from realworld.
On the live demo
from realworld.
The missing files have been added in da253e4
from realworld.
Related Issues (20)
- Update SvelteKit realword with breaking change "Removing session #5883" and persistent login HOT 2
- Use SvelteKits's provided fetch method for requests HOT 1
- Cannot read properties of null (reading 'split')
- Profile endpoint throwing error HOT 1
- Pages do not change HOT 6
- Fetch failed HOT 1
- demo site is down (realworld.svelte.dev -> 530) HOT 1
- A working demo with authentication HOT 4
- npm install and npm run dev are not working in latest realworld project HOT 1
- Update this project for svelteKit 1.0.0 HOT 1
- Why this project is using form actions for even logout feature? HOT 4
- cookies are not getting set when running npm run dev -- --host HOT 1
- Static site generation of this project giving error. HOT 1
- btoa and atob deprecated HOT 1
- Build generated from adapter-node is not working for realWorld example HOT 1
- Showing validation errors in login form
- Localisation
- Add use of .env files for dev and prod evvironment HOT 4
- How to add remember me functionality at login page in this project? HOT 1
- Something went wrong HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from realworld.