Senior
November 18, 2026

Spot the bug: Vue.js / Nuxt.js

One snippet. Find the bug, or prove there isn't one.

typescript
1// services/apiClient.ts
2class ApiClient {
3  private static instance: ApiClient
4  private token: string | null = null
5
6  static getInstance() {
7    if (!ApiClient.instance) ApiClient.instance = new ApiClient()
8    return ApiClient.instance
9  }
10
11  setToken(token: string) { this.token = token }
12  getToken() { return this.token }
13}
14
15// plugins/api.ts (Nuxt SSR)
16export default defineNuxtPlugin(() => {
17  const client = ApiClient.getInstance()
18  const token = useCookie('token').value
19  if (token) client.setToken(token)
20  return { provide: { api: client } }
21})

Click the lines that carry the problem.

Your verdict

One attempt per day. The answer shows up right after.

Keep your streak

Create an account to keep your streak and track your progress.

Create an account