-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
131 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,5 +244,6 @@ | |
"height": 380 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* eslint-disable no-param-reassign */ | ||
import { produce } from 'immer' | ||
import type { IStore } from '../useStore' | ||
|
||
const storeCloud = (set: any) => ({ | ||
loginDialog: false, | ||
setLoginDialog: (open: boolean) => { | ||
set( | ||
produce((state: IStore) => { | ||
state.loginDialog = open | ||
}), | ||
false, | ||
'cloud/setLoginDialog' | ||
) | ||
} | ||
}) | ||
|
||
export default storeCloud |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import axios from 'axios' | ||
|
||
const cloud = axios.create({ | ||
baseURL: 'https://strapi.yeonv.com' | ||
}) | ||
|
||
const login = async (search: string) => { | ||
await fetch(`https://strapi.yeonv.com/auth/github/callback?${search}`) | ||
.then((res) => { | ||
if (res.status !== 200) { | ||
throw new Error(`Couldn't login to Strapi. Status: ${res.status}`) | ||
} | ||
return res | ||
}) | ||
.then((res) => res.json()) | ||
.then(async (res) => { | ||
localStorage.setItem('jwt', res.jwt) | ||
localStorage.setItem('username', res.user.username) | ||
const me = await cloud.get('users/me', { | ||
headers: { | ||
Authorization: `Bearer ${localStorage.getItem('jwt')}` | ||
} | ||
}) | ||
const user = await me.data | ||
localStorage.setItem('ledfx-cloud-userid', user.id) | ||
localStorage.setItem('ledfx-cloud-role', user.role.type) | ||
// setTimeout(() => { | ||
// return isElectron() ? window.close() : history('/devices') | ||
// }, 2000) | ||
}) | ||
.catch((err) => { | ||
// eslint-disable-next-line no-console | ||
console.log(err) | ||
}) | ||
} | ||
|
||
export default login |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nodeLinker: node-modules | ||
|
||
pnpFallbackMode: all |